diff --git a/cardano-constitution/src/Cardano/Constitution/Config.hs b/cardano-constitution/src/Cardano/Constitution/Config.hs index 81a1103ea36..2d2d98a9145 100644 --- a/cardano-constitution/src/Cardano/Constitution/Config.hs +++ b/cardano-constitution/src/Cardano/Constitution/Config.hs @@ -19,7 +19,7 @@ import Data.Aeson.THReader as Aeson -- | The default config read from "data/defaultConstitution.json" defaultConstitutionConfig :: ConstitutionConfig -defaultConstitutionConfig = $$(Aeson.readJSONFromFile DFP.defaultConstitutionConfigFile) +defaultConstitutionConfig = Aeson.readJSONFromFile DFP.defaultConstitutionConfigFile {-# INLINEABLE defaultConstitutionConfig #-} -- | NOTE: **BE CAREFUL** of the ordering. Expected value is first arg, Proposed Value is second arg diff --git a/cardano-constitution/test/Cardano/Constitution/Config/Tests.hs b/cardano-constitution/test/Cardano/Constitution/Config/Tests.hs index 4ef58cd5f6a..0e2f4fd8aff 100644 --- a/cardano-constitution/test/Cardano/Constitution/Config/Tests.hs +++ b/cardano-constitution/test/Cardano/Constitution/Config/Tests.hs @@ -19,8 +19,7 @@ import Helpers.TestBuilders import Test.Tasty.QuickCheck defaultConstitutionJSONSchema :: Aeson.Value -defaultConstitutionJSONSchema = - $$(Aeson.readJSONFromFile DFP.defaultConstitutionJSONSchemaFile) +defaultConstitutionJSONSchema = Aeson.readJSONFromFile DFP.defaultConstitutionJSONSchemaFile {-| All the examples in the JSON schema are parseable as a list of ConstitutionConfigs. Actually the examples 9005 and 9006 should not normally parse, diff --git a/plutus-core/cost-model/CostModelGeneration.md b/plutus-core/cost-model/CostModelGeneration.md index f1431016da7..95e8c66d2e2 100644 --- a/plutus-core/cost-model/CostModelGeneration.md +++ b/plutus-core/cost-model/CostModelGeneration.md @@ -40,9 +40,9 @@ costing functions involves a number of steps. when testing costing benchmarks. * Change directory to `plutus-core/cost-model/data/` and run `cabal run - plutus-core:generate-cost-model -- --csv `, where `` is the CSV - file produced in the previous step. This runs some R code in - [`plutus-core/cost-model/data/models.R`](./data/models.R) which fits a linear + plutus-core:generate-cost-model -- --csv -o `, where `` is the CSV + file produced in the previous step and `` is the Haskell module file to generate. + This runs some R code in [`plutus-core/cost-model/data/models.R`](./data/models.R) which fits a linear model to the data for each builtin; the general form of the model for each builtin is coded into `models.R`. Certain checks are performed during this process: for example it is possible that R will generate a model with a @@ -50,7 +50,7 @@ costing functions involves a number of steps. constant) and if that happens then a warning is printed and the coefficient is replaced by zero. - * The output of `generate-cost-model` is a JSON object describing the form of + * The output of `generate-cost-model` is a Haskell module file describing the form of the models for each builtin, together with the model coefficients fitted by R. By default this is written to the terminal, but an output file can be specified with `-o`. The model coefficients are converted from floating point @@ -60,23 +60,23 @@ costing functions involves a number of steps. on different machines). * The specific cost model data to be used by the Plutus Core evaluator should be - checked in to git in the file - [`plutus-core/cost-model/data/builtinCostModelC.json`](./data/builtinCostModelC.json). - There are also files called `builtinCostModelA.json` and - `builtinCostModelB.json` which are used for evaluating scripts prior to the - Chang hard fork: data for new builtins can (if fact, must) be added to these - files, but the existing content must not be changed. The CSV file containing - the benchmark results used to generate the cost model should be checked in to - the repository; this is not strictly necessary but it can be useful to have - the raw data available if the details of the cost model need to be looked at - at some later time. The benchmarking results used to generate the current cost - model (March 2025) are checked in in + checked in to git as Haskell modules in the directory + [`plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/CostModel/Generated/`](../plutus-core/src/PlutusCore/Evaluation/Machine/CostModel/Generated/). + The module `BuiltinCostModelC.hs` contains the cost model for the latest version. + There are also modules called `BuiltinCostModelA.hs` and `BuiltinCostModelB.hs` + which are used for evaluating scripts prior to the Chang hard fork: data for new + builtins can (if fact, must) be added to these files, but the existing content + must not be changed. The CSV file containing the benchmark results used to generate + the cost model should be checked in to the repository; this is not strictly necessary + but it can be useful to have the raw data available if the details of the cost model + need to be looked at at some later time. The benchmarking results used to generate + the current cost model (March 2025) are checked in in [`plutus-core/cost-model/data/benching-conway.csv`](./data/benching-conway.csv) and any new results should be added to the end of that file. -* When the rest of the `plutus-core` package is compiled, the contents of - `builtCostModelC.json` are read and used by some Template Haskell code to - construct Haskell functions which implement the cost models. +* When the rest of the `plutus-core` package is compiled, the generated Haskell + modules are directly imported and used to construct the cost models. This + eliminates the need for Template Haskell file reading at compile time. * To ensure consistency, `cabal bench plutus-core:cost-model-test` runs some QuickCheck tests to run the R models and the Haskell models and checks that @@ -96,8 +96,8 @@ costing functions involves a number of steps. predicted by the builtin cost model, and divide the remaining time by the number of basic machine steps executed to arrive at an average time for each machine step (see the earlier discussion). - This is then stored in another JSON file, - [`plutus-core/cost-model/data/cekMachineCosts.json`](./data/cekMachineCosts.json). + This is then stored in Haskell modules in the `CostModel/Generated/` directory, + such as [`CekMachineCostsC.hs`](../plutus-core/src/PlutusCore/Evaluation/Machine/CostModel/Generated/CekMachineCostsC.hs). This cost is currently the same for each step, but more careful testing may enable us to produce more precise costs per step at some future date. The JSON file also contains a constant cost for diff --git a/plutus-core/cost-model/create-cost-model/Main.hs b/plutus-core/cost-model/create-cost-model/Main.hs index 4671a470e5d..794c6e4a86d 100644 --- a/plutus-core/cost-model/create-cost-model/Main.hs +++ b/plutus-core/cost-model/create-cost-model/Main.hs @@ -1,19 +1,27 @@ +{-# LANGUAGE OverloadedStrings #-} + module Main where import CreateBuiltinCostModel (createBuiltinCostModel) - -import Data.Aeson.Encode.Pretty -import Data.ByteString.Lazy qualified as BSL (ByteString, putStr, writeFile) +import PlutusCore.Evaluation.Machine.BuiltinCostModel (BuiltinCostModel) + +import Data.Aeson +import Data.Aeson.Encode.Pretty (Config (..), defConfig, encodePretty') +import Data.ByteString.Lazy.Char8 qualified as BSL +import Data.Char (toLower) +import Data.Text qualified as T +import Data.Text.IO qualified as T import Options.Applicative import System.Directory import System.Exit import System.IO (hPutStrLn, stderr) +import Text.Show.Pretty (ppShow) import Language.R (defaultConfig, runRegion, withEmbeddedR) {-| This takes a CSV file of benchmark results for built-in functions, runs the R code in `models.R` to construct costing functions based on the benchmark - results, and then produces JSON output containing the types and coefficients + results, and then produces Haskell module output containing the types and coefficients of the costing functions. For best results, run this in `plutus-core/cost-model/data` to make `models.R` easy to find; if that's inconvenient for some reason, use the `-m` option to provide a path to @@ -36,7 +44,7 @@ data RFile = RFile FilePath defaultRFile :: RFile defaultRFile = RFile "models.R" --- | Where to write the JSON output, stdout by default +-- | Where to write the Haskell module output, stdout by default data Output = NamedOutput FilePath | StdOutput ---------------- Option parsers ---------------- @@ -80,8 +88,8 @@ fileOutput = <$> strOption ( long "output" <> short 'o' - <> metavar "FILENAME" - <> help "Output file" + <> metavar "MODULENAME" + <> help "Output Haskell module name, e.g. BuiltinCostModelA, will be placed under PlutusCore/Evaluation/Machine/CostModel/Generated" ) stdOutput :: Parser Output @@ -102,7 +110,7 @@ arguments = ( fullDesc <> header "Plutus Core cost model creation tool" <> progDesc - ( "Creates a JSON description of Plutus Core cost model " + ( "Creates a Haskell module containing the Plutus Core cost model " ++ "for built-in functions from a set of benchmark results " ++ "produced by cost-model-budgeting-bench" ) @@ -145,17 +153,50 @@ checkBenchmarkFile file = ++ "The default results file is plutus-core/cost-model/data/benching.csv." in checkInputFile file "benchmark results file" advice -writeOutput - :: Output -> BSL.ByteString -> IO () -writeOutput outp v = do +writeOutput :: Output -> BuiltinCostModel -> IO () +writeOutput outp model = do case outp of - NamedOutput file -> BSL.writeFile file v - StdOutput -> BSL.putStr v + NamedOutput moduleName -> do + let (modulePath, moduleCode) = generateCostModelHaskellModule moduleName model + T.writeFile modulePath moduleCode + StdOutput -> + BSL.putStr modelJson + where + modelJson = encodePretty' (defConfig {confCompare = \_ _ -> EQ}) model + +generateCostModelHaskellModule :: String -> BuiltinCostModel -> (FilePath, T.Text) +generateCostModelHaskellModule moduleName model = (modulePath, moduleCode) + where + modulePath = "plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/CostModel/" <> moduleName <> ".hs" + modelId = T.pack (toLowerFirstCharOnly moduleName) + moduleCode = + T.unlines + [ "-- This file is auto-generated by the generate-cost-model executable." + , "-- Do not edit this file manually." + , "" + , "module PlutusCore.Evaluation.Machine.CostModel." <> T.pack moduleName <> " (" <> modelId <> ") where" + , "" + , "import PlutusCore.Evaluation.Machine.BuiltinCostModel" + , "" + , modelId <> " :: BuiltinCostModel" + , modelId <> " = " <> T.pack (ppShow model) + ] + + toLowerFirstCharOnly :: String -> String + toLowerFirstCharOnly "" = "" + toLowerFirstCharOnly (c : cs) = toLower c : cs main :: IO () main = do (BenchmarkFile bmfile, RFile rfile, out) <- execParser arguments - checkBenchmarkFile bmfile - checkRFile rfile - model <- withEmbeddedR defaultConfig $ runRegion $ createBuiltinCostModel bmfile rfile - writeOutput out $ encodePretty' (defConfig {confCompare = \_ _ -> EQ}) model + -- checkBenchmarkFile bmfile + -- checkRFile rfile + -- model <- withEmbeddedR defaultConfig $ runRegion $ createBuiltinCostModel bmfile rfile + -- writeOutput out model + case out of + NamedOutput moduleName -> do + model <- eitherDecodeFileStrict ("plutus-core/cost-model/data/builtinCostModelA.json") + case model of + Left err -> putStrLn err + Right model' -> writeOutput out model' + _ -> undefined diff --git a/plutus-core/plutus-core.cabal b/plutus-core/plutus-core.cabal index 5afd8ca1ceb..cd7534a349d 100644 --- a/plutus-core/plutus-core.cabal +++ b/plutus-core/plutus-core.cabal @@ -22,13 +22,8 @@ extra-doc-files: -- `data-files`. See https://github.com/haskell/cabal/pull/6889 and the issue -- #4746 that it mentions. extra-source-files: + cost-model/data/*.csv cost-model/data/*.R - cost-model/data/builtinCostModelA.json - cost-model/data/builtinCostModelB.json - cost-model/data/builtinCostModelC.json - cost-model/data/cekMachineCostsA.json - cost-model/data/cekMachineCostsB.json - cost-model/data/cekMachineCostsC.json plutus-core/test/CostModelInterface/defaultCostModelParams.json source-repository head @@ -136,6 +131,12 @@ library PlutusCore.Evaluation.Machine.CostingFun.Core PlutusCore.Evaluation.Machine.CostingFun.JSON PlutusCore.Evaluation.Machine.CostingFun.SimpleJSON + PlutusCore.Evaluation.Machine.CostModel.BuiltinCostModelA + PlutusCore.Evaluation.Machine.CostModel.BuiltinCostModelB + PlutusCore.Evaluation.Machine.CostModel.BuiltinCostModelC + PlutusCore.Evaluation.Machine.CostModel.CekMachineCostsA + PlutusCore.Evaluation.Machine.CostModel.CekMachineCostsB + PlutusCore.Evaluation.Machine.CostModel.CekMachineCostsC PlutusCore.Evaluation.Machine.CostModelInterface PlutusCore.Evaluation.Machine.CostStream PlutusCore.Evaluation.Machine.ExBudget @@ -350,7 +351,6 @@ library , text , th-lift , th-lift-instances - , th-utilities , time , transformers , unordered-containers @@ -992,6 +992,7 @@ executable generate-cost-model buildable: False build-depends: + , aeson , aeson-pretty , barbies , base >=4.9 && <5 @@ -1000,9 +1001,9 @@ executable generate-cost-model , inline-r >=1.0.1 , optparse-applicative , plutus-core ^>=1.58 + , pretty-show , text - -- , exceptions other-modules: BuiltinMemoryModels CreateBuiltinCostModel diff --git a/plutus-core/plutus-core/src/Data/Aeson/THReader.hs b/plutus-core/plutus-core/src/Data/Aeson/THReader.hs index e2ae91f50bb..e152342dd5d 100644 --- a/plutus-core/plutus-core/src/Data/Aeson/THReader.hs +++ b/plutus-core/plutus-core/src/Data/Aeson/THReader.hs @@ -3,12 +3,11 @@ module Data.Aeson.THReader where import Data.Aeson -import Language.Haskell.TH.Syntax -import TH.RelativePaths +import System.IO.Unsafe -readJSONFromFile :: (FromJSON a, Lift a) => String -> Code Q a -readJSONFromFile name = liftCode $ do - contents <- qReadFileLBS name - case eitherDecode contents of - Left err -> fail err - Right res -> examineCode [||res||] +{-# OPAQUE readJSONFromFile #-} +readJSONFromFile :: FromJSON a => String -> a +readJSONFromFile path = + case unsafePerformIO (eitherDecodeFileStrict path) of + Left err -> error ("Failed to decode json file " <> path <> ":\n" <> err) + Right res -> res diff --git a/plutus-core/plutus-core/src/PlutusCore/DataFilePaths.hs b/plutus-core/plutus-core/src/PlutusCore/DataFilePaths.hs index 29e4b7a783b..379005a54a1 100644 --- a/plutus-core/plutus-core/src/PlutusCore/DataFilePaths.hs +++ b/plutus-core/plutus-core/src/PlutusCore/DataFilePaths.hs @@ -1,54 +1,19 @@ -{-| Various file paths used in plutus-core, currently all to do with the cost -model. -} -module PlutusCore.DataFilePaths -where +{-| Various file paths used in plutus-core. + These paths are primarily used for testing and benchmarking. + Cost models are embedded as Haskell modules in + PlutusCore.Evaluation.Machine.CostModel.* -} +module PlutusCore.DataFilePaths where import System.FilePath costModelDataDir :: FilePath costModelDataDir = "cost-model" "data" -builtinCostModelFileA :: FilePath -builtinCostModelFileA = costModelDataDir "builtinCostModelA" <.> "json" - -builtinCostModelFileB :: FilePath -builtinCostModelFileB = costModelDataDir "builtinCostModelB" <.> "json" - -builtinCostModelFileC :: FilePath -builtinCostModelFileC = costModelDataDir "builtinCostModelC" <.> "json" - -builtinCostModelFileD :: FilePath -builtinCostModelFileD = costModelDataDir "builtinCostModelB" <.> "json" - -builtinCostModelFileE :: FilePath -builtinCostModelFileE = costModelDataDir "builtinCostModelC" <.> "json" - -latestBuiltinCostModelFile :: FilePath -latestBuiltinCostModelFile = builtinCostModelFileC - -cekMachineCostsFileA :: FilePath -cekMachineCostsFileA = costModelDataDir "cekMachineCostsA" <.> "json" - -cekMachineCostsFileB :: FilePath -cekMachineCostsFileB = costModelDataDir "cekMachineCostsB" <.> "json" - -cekMachineCostsFileC :: FilePath -cekMachineCostsFileC = costModelDataDir "cekMachineCostsC" <.> "json" - -cekMachineCostsFileD :: FilePath -cekMachineCostsFileD = costModelDataDir "cekMachineCostsB" <.> "json" - -cekMachineCostsFileE :: FilePath -cekMachineCostsFileE = costModelDataDir "cekMachineCostsC" <.> "json" - -latestMachineCostsFile :: FilePath -latestMachineCostsFile = cekMachineCostsFileC - --- | The file containing the R models: only needed for cost-model-test. +-- | The file containing the R models: needed for cost-model-test and generate-cost-model. rModelFile :: FilePath rModelFile = costModelDataDir "models" <.> "R" -{-| The file containing the benchmark results for the built-in functions: only -needed for cost-model-test. -} +{-| The file containing the benchmark results for the built-in functions: +needed for cost-model-test and generate-cost-model. -} benchingResultsFile :: FilePath benchingResultsFile = costModelDataDir "benching-conway" <.> "csv" diff --git a/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/CostModel/BuiltinCostModelA.hs b/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/CostModel/BuiltinCostModelA.hs new file mode 100644 index 00000000000..fd9a5a904a3 --- /dev/null +++ b/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/CostModel/BuiltinCostModelA.hs @@ -0,0 +1,1002 @@ +-- This file is auto-generated by the generate-cost-model executable. +-- Do not edit this file manually. + +module PlutusCore.Evaluation.Machine.CostModel.BuiltinCostModelA (builtinCostModelA) where + +import PlutusCore.Evaluation.Machine.BuiltinCostModel + +builtinCostModelA :: BuiltinCostModel +builtinCostModelA = + BuiltinCostModelBase + { paramAddInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsMaxSize + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 205665 + , oneVariableLinearFunctionSlope = 812 + } + , costingFunMemory = + ModelTwoArgumentsMaxSize + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramSubtractInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsMaxSize + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 205665 + , oneVariableLinearFunctionSlope = 812 + } + , costingFunMemory = + ModelTwoArgumentsMaxSize + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramMultiplyInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsAddedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 69522 + , oneVariableLinearFunctionSlope = 11687 + } + , costingFunMemory = + ModelTwoArgumentsAddedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramDivideInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsConstAboveDiagonal + ModelConstantOrTwoArguments + { modelConstantOrTwoArgumentsConstant = 196500 + , modelConstantOrTwoArgumentsModel = + ModelTwoArgumentsMultipliedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 453240 + , oneVariableLinearFunctionSlope = 220 + } + } + , costingFunMemory = + ModelTwoArgumentsSubtractedSizes + ModelSubtractedSizes + { modelSubtractedSizesIntercept = 0 + , modelSubtractedSizesSlope = 1 + , modelSubtractedSizesMinimum = 1 + } + } + , paramQuotientInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsConstAboveDiagonal + ModelConstantOrTwoArguments + { modelConstantOrTwoArgumentsConstant = 196500 + , modelConstantOrTwoArgumentsModel = + ModelTwoArgumentsMultipliedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 453240 + , oneVariableLinearFunctionSlope = 220 + } + } + , costingFunMemory = + ModelTwoArgumentsSubtractedSizes + ModelSubtractedSizes + { modelSubtractedSizesIntercept = 0 + , modelSubtractedSizesSlope = 1 + , modelSubtractedSizesMinimum = 1 + } + } + , paramRemainderInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsConstAboveDiagonal + ModelConstantOrTwoArguments + { modelConstantOrTwoArgumentsConstant = 196500 + , modelConstantOrTwoArgumentsModel = + ModelTwoArgumentsMultipliedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 453240 + , oneVariableLinearFunctionSlope = 220 + } + } + , costingFunMemory = + ModelTwoArgumentsSubtractedSizes + ModelSubtractedSizes + { modelSubtractedSizesIntercept = 0 + , modelSubtractedSizesSlope = 1 + , modelSubtractedSizesMinimum = 1 + } + } + , paramModInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsConstAboveDiagonal + ModelConstantOrTwoArguments + { modelConstantOrTwoArgumentsConstant = 196500 + , modelConstantOrTwoArgumentsModel = + ModelTwoArgumentsMultipliedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 453240 + , oneVariableLinearFunctionSlope = 220 + } + } + , costingFunMemory = + ModelTwoArgumentsSubtractedSizes + ModelSubtractedSizes + { modelSubtractedSizesIntercept = 0 + , modelSubtractedSizesSlope = 1 + , modelSubtractedSizesMinimum = 1 + } + } + , paramEqualsInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsMinSize + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 208512 + , oneVariableLinearFunctionSlope = 421 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramLessThanInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsMinSize + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 208896 + , oneVariableLinearFunctionSlope = 511 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramLessThanEqualsInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsMinSize + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 204924 + , oneVariableLinearFunctionSlope = 473 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramAppendByteString = + CostingFun + { costingFunCpu = + ModelTwoArgumentsAddedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1000 + , oneVariableLinearFunctionSlope = 571 + } + , costingFunMemory = + ModelTwoArgumentsAddedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramConsByteString = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInY + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 221973 + , oneVariableLinearFunctionSlope = 511 + } + , costingFunMemory = + ModelTwoArgumentsAddedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramSliceByteString = + CostingFun + { costingFunCpu = + ModelThreeArgumentsLinearInZ + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 265318 + , oneVariableLinearFunctionSlope = 0 + } + , costingFunMemory = + ModelThreeArgumentsLinearInZ + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 4 + , oneVariableLinearFunctionSlope = 0 + } + } + , paramLengthOfByteString = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 1000 + , costingFunMemory = ModelOneArgumentConstantCost 10 + } + , paramIndexByteString = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 57667 + , costingFunMemory = ModelTwoArgumentsConstantCost 4 + } + , paramEqualsByteString = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearOnDiagonal + ModelConstantOrLinear + { modelConstantOrLinearConstant = 245000 + , modelConstantOrLinearIntercept = 216773 + , modelConstantOrLinearSlope = 62 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramLessThanByteString = + CostingFun + { costingFunCpu = + ModelTwoArgumentsMinSize + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 197145 + , oneVariableLinearFunctionSlope = 156 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramLessThanEqualsByteString = + CostingFun + { costingFunCpu = + ModelTwoArgumentsMinSize + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 197145 + , oneVariableLinearFunctionSlope = 156 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramSha2_256 = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 806990 + , oneVariableLinearFunctionSlope = 30482 + } + , costingFunMemory = ModelOneArgumentConstantCost 4 + } + , paramSha3_256 = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1927926 + , oneVariableLinearFunctionSlope = 82523 + } + , costingFunMemory = ModelOneArgumentConstantCost 4 + } + , paramBlake2b_256 = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 117366 + , oneVariableLinearFunctionSlope = 10475 + } + , costingFunMemory = ModelOneArgumentConstantCost 4 + } + , paramVerifyEd25519Signature = + CostingFun + { costingFunCpu = + ModelThreeArgumentsLinearInZ + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 57996947 + , oneVariableLinearFunctionSlope = 18975 + } + , costingFunMemory = ModelThreeArgumentsConstantCost 10 + } + , paramVerifyEcdsaSecp256k1Signature = + CostingFun + { costingFunCpu = ModelThreeArgumentsConstantCost 35190005 + , costingFunMemory = ModelThreeArgumentsConstantCost 10 + } + , paramVerifySchnorrSecp256k1Signature = + CostingFun + { costingFunCpu = + ModelThreeArgumentsLinearInY + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 39121781 + , oneVariableLinearFunctionSlope = 32260 + } + , costingFunMemory = ModelThreeArgumentsConstantCost 10 + } + , paramAppendString = + CostingFun + { costingFunCpu = + ModelTwoArgumentsAddedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1000 + , oneVariableLinearFunctionSlope = 24177 + } + , costingFunMemory = + ModelTwoArgumentsAddedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 4 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramEqualsString = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearOnDiagonal + ModelConstantOrLinear + { modelConstantOrLinearConstant = 187000 + , modelConstantOrLinearIntercept = 1000 + , modelConstantOrLinearSlope = 52998 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramEncodeUtf8 = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1000 + , oneVariableLinearFunctionSlope = 28662 + } + , costingFunMemory = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 4 + , oneVariableLinearFunctionSlope = 2 + } + } + , paramDecodeUtf8 = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 497525 + , oneVariableLinearFunctionSlope = 14068 + } + , costingFunMemory = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 4 + , oneVariableLinearFunctionSlope = 2 + } + } + , paramIfThenElse = + CostingFun + { costingFunCpu = ModelThreeArgumentsConstantCost 80556 + , costingFunMemory = ModelThreeArgumentsConstantCost 1 + } + , paramChooseUnit = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 46417 + , costingFunMemory = ModelTwoArgumentsConstantCost 4 + } + , paramTrace = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 212342 + , costingFunMemory = ModelTwoArgumentsConstantCost 32 + } + , paramFstPair = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 80436 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramSndPair = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 85931 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramChooseList = + CostingFun + { costingFunCpu = ModelThreeArgumentsConstantCost 175354 + , costingFunMemory = ModelThreeArgumentsConstantCost 32 + } + , paramMkCons = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 65493 + , costingFunMemory = ModelTwoArgumentsConstantCost 32 + } + , paramHeadList = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 43249 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramTailList = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 41182 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramNullList = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 60091 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramChooseData = + CostingFun + { costingFunCpu = ModelSixArgumentsConstantCost 19537 + , costingFunMemory = ModelSixArgumentsConstantCost 32 + } + , paramConstrData = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 89141 + , costingFunMemory = ModelTwoArgumentsConstantCost 32 + } + , paramMapData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 64832 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramListData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 52467 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramIData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 1000 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramBData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 1000 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramUnConstrData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 32696 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramUnMapData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 38314 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramUnListData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 32247 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramUnIData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 43357 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramUnBData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 31220 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramEqualsData = + CostingFun + { costingFunCpu = + ModelTwoArgumentsMinSize + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1060367 + , oneVariableLinearFunctionSlope = 12586 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramMkPairData = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 76511 + , costingFunMemory = ModelTwoArgumentsConstantCost 32 + } + , paramMkNilData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 22558 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramMkNilPairData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 16563 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramSerialiseData = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1159724 + , oneVariableLinearFunctionSlope = 392670 + } + , costingFunMemory = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 2 + } + } + , paramBls12_381_G1_add = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 962335 + , costingFunMemory = ModelTwoArgumentsConstantCost 18 + } + , paramBls12_381_G1_neg = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 267929 + , costingFunMemory = ModelOneArgumentConstantCost 18 + } + , paramBls12_381_G1_scalarMul = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 76433006 + , oneVariableLinearFunctionSlope = 8868 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 18 + } + , paramBls12_381_G1_multiScalarMul = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 321837444 + , oneVariableLinearFunctionSlope = 25087669 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 18 + } + , paramBls12_381_G1_equal = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 442008 + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramBls12_381_G1_compress = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 2780678 + , costingFunMemory = ModelOneArgumentConstantCost 6 + } + , paramBls12_381_G1_uncompress = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 52948122 + , costingFunMemory = ModelOneArgumentConstantCost 18 + } + , paramBls12_381_G1_hashToGroup = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 52538055 + , oneVariableLinearFunctionSlope = 3756 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 18 + } + , paramBls12_381_G2_add = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 1995836 + , costingFunMemory = ModelTwoArgumentsConstantCost 36 + } + , paramBls12_381_G2_neg = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 284546 + , costingFunMemory = ModelOneArgumentConstantCost 36 + } + , paramBls12_381_G2_scalarMul = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 158221314 + , oneVariableLinearFunctionSlope = 26549 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 36 + } + , paramBls12_381_G2_equal = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 901022 + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramBls12_381_G2_multiScalarMul = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 617887431 + , oneVariableLinearFunctionSlope = 67302824 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 36 + } + , paramBls12_381_G2_compress = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 3227919 + , costingFunMemory = ModelOneArgumentConstantCost 12 + } + , paramBls12_381_G2_uncompress = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 74698472 + , costingFunMemory = ModelOneArgumentConstantCost 36 + } + , paramBls12_381_G2_hashToGroup = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 166917843 + , oneVariableLinearFunctionSlope = 4307 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 36 + } + , paramBls12_381_millerLoop = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 254006273 + , costingFunMemory = ModelTwoArgumentsConstantCost 72 + } + , paramBls12_381_mulMlResult = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 2174038 + , costingFunMemory = ModelTwoArgumentsConstantCost 72 + } + , paramBls12_381_finalVerify = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 333849714 + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramKeccak_256 = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 2261318 + , oneVariableLinearFunctionSlope = 64571 + } + , costingFunMemory = ModelOneArgumentConstantCost 4 + } + , paramBlake2b_224 = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 207616 + , oneVariableLinearFunctionSlope = 8310 + } + , costingFunMemory = ModelOneArgumentConstantCost 4 + } + , paramIntegerToByteString = + CostingFun + { costingFunCpu = + ModelThreeArgumentsQuadraticInZ + OneVariableQuadraticFunction + { oneVariableQuadraticFunctionC0 = 1293828 + , oneVariableQuadraticFunctionC1 = 28716 + , oneVariableQuadraticFunctionC2 = 63 + } + , costingFunMemory = + ModelThreeArgumentsLiteralInYOrLinearInZ + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramByteStringToInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsQuadraticInY + OneVariableQuadraticFunction + { oneVariableQuadraticFunctionC0 = 1006041 + , oneVariableQuadraticFunctionC1 = 43623 + , oneVariableQuadraticFunctionC2 = 251 + } + , costingFunMemory = + ModelTwoArgumentsLinearInY + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramAndByteString = + CostingFun + { costingFunCpu = + ModelThreeArgumentsLinearInYAndZ + TwoVariableLinearFunction + { twoVariableLinearFunctionIntercept = 100181 + , twoVariableLinearFunctionSlope1 = 726 + , twoVariableLinearFunctionSlope2 = 719 + } + , costingFunMemory = + ModelThreeArgumentsLinearInMaxYZ + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramOrByteString = + CostingFun + { costingFunCpu = + ModelThreeArgumentsLinearInYAndZ + TwoVariableLinearFunction + { twoVariableLinearFunctionIntercept = 100181 + , twoVariableLinearFunctionSlope1 = 726 + , twoVariableLinearFunctionSlope2 = 719 + } + , costingFunMemory = + ModelThreeArgumentsLinearInMaxYZ + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramXorByteString = + CostingFun + { costingFunCpu = + ModelThreeArgumentsLinearInYAndZ + TwoVariableLinearFunction + { twoVariableLinearFunctionIntercept = 100181 + , twoVariableLinearFunctionSlope1 = 726 + , twoVariableLinearFunctionSlope2 = 719 + } + , costingFunMemory = + ModelThreeArgumentsLinearInMaxYZ + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramComplementByteString = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 107878 + , oneVariableLinearFunctionSlope = 680 + } + , costingFunMemory = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramReadBit = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 95336 + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramWriteBits = + CostingFun + { costingFunCpu = + ModelThreeArgumentsLinearInY + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 281145 + , oneVariableLinearFunctionSlope = 18848 + } + , costingFunMemory = + ModelThreeArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramReplicateByte = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 180194 + , oneVariableLinearFunctionSlope = 159 + } + , costingFunMemory = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramShiftByteString = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 158519 + , oneVariableLinearFunctionSlope = 8942 + } + , costingFunMemory = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramRotateByteString = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 159378 + , oneVariableLinearFunctionSlope = 8813 + } + , costingFunMemory = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramCountSetBits = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 107490 + , oneVariableLinearFunctionSlope = 3298 + } + , costingFunMemory = ModelOneArgumentConstantCost 1 + } + , paramFindFirstSetBit = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 106057 + , oneVariableLinearFunctionSlope = 655 + } + , costingFunMemory = ModelOneArgumentConstantCost 1 + } + , paramRipemd_160 = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1964219 + , oneVariableLinearFunctionSlope = 24520 + } + , costingFunMemory = ModelOneArgumentConstantCost 3 + } + , paramExpModInteger = + CostingFun + { costingFunCpu = + ModelThreeArgumentsExpModCost + ExpModCostingFunction + { coefficient00 = 607153 + , coefficient11 = 231697 + , coefficient12 = 53144 + } + , costingFunMemory = + ModelThreeArgumentsLinearInZ + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramDropList = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 116711 + , oneVariableLinearFunctionSlope = 1957 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 4 + } + , paramLengthOfArray = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 231883 + , costingFunMemory = ModelOneArgumentConstantCost 10 + } + , paramListToArray = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1000 + , oneVariableLinearFunctionSlope = 24838 + } + , costingFunMemory = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 7 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramIndexArray = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 232010 + , costingFunMemory = ModelTwoArgumentsConstantCost 32 + } + , paramLookupCoin = + CostingFun + { costingFunCpu = + ModelThreeArgumentsLinearInZ + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 219951 + , oneVariableLinearFunctionSlope = 9444 + } + , costingFunMemory = ModelThreeArgumentsConstantCost 1 + } + , paramValueContains = + CostingFun + { costingFunCpu = + ModelTwoArgumentsConstAboveDiagonal + ModelConstantOrTwoArguments + { modelConstantOrTwoArgumentsConstant = 213283 + , modelConstantOrTwoArgumentsModel = + ModelTwoArgumentsLinearInXAndY + TwoVariableLinearFunction + { twoVariableLinearFunctionIntercept = 618401 + , twoVariableLinearFunctionSlope1 = 1998 + , twoVariableLinearFunctionSlope2 = 28258 + } + } + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramValueData = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1000 + , oneVariableLinearFunctionSlope = 38159 + } + , costingFunMemory = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 2 + , oneVariableLinearFunctionSlope = 22 + } + } + , paramUnValueData = + CostingFun + { costingFunCpu = + ModelOneArgumentQuadraticInX + OneVariableQuadraticFunction + { oneVariableQuadraticFunctionC0 = 1000 + , oneVariableQuadraticFunctionC1 = 95933 + , oneVariableQuadraticFunctionC2 = 1 + } + , costingFunMemory = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 11 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramInsertCoin = + CostingFun + { costingFunCpu = + ModelFourArgumentsLinearInU + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 356924 + , oneVariableLinearFunctionSlope = 18413 + } + , costingFunMemory = + ModelFourArgumentsLinearInU + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 45 + , oneVariableLinearFunctionSlope = 21 + } + } + , paramUnionValue = + CostingFun + { costingFunCpu = + ModelTwoArgumentsWithInteractionInXAndY + TwoVariableWithInteractionFunction + { twoVariableWithInteractionFunctionC00 = 1000 + , twoVariableWithInteractionFunctionC10 = 172116 + , twoVariableWithInteractionFunctionC01 = 183150 + , twoVariableWithInteractionFunctionC11 = 6 + } + , costingFunMemory = + ModelTwoArgumentsAddedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 24 + , oneVariableLinearFunctionSlope = 21 + } + } + , paramScaleValue = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInY + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1000 + , oneVariableLinearFunctionSlope = 277577 + } + , costingFunMemory = + ModelTwoArgumentsLinearInY + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 12 + , oneVariableLinearFunctionSlope = 21 + } + } + } diff --git a/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/CostModel/BuiltinCostModelB.hs b/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/CostModel/BuiltinCostModelB.hs new file mode 100644 index 00000000000..fd1c7ad83d0 --- /dev/null +++ b/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/CostModel/BuiltinCostModelB.hs @@ -0,0 +1,1002 @@ +-- This file is auto-generated by the generate-cost-model executable. +-- Do not edit this file manually. + +module PlutusCore.Evaluation.Machine.CostModel.BuiltinCostModelB (builtinCostModelB) where + +import PlutusCore.Evaluation.Machine.BuiltinCostModel + +builtinCostModelB :: BuiltinCostModel +builtinCostModelB = + BuiltinCostModelBase + { paramAddInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsMaxSize + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 100788 + , oneVariableLinearFunctionSlope = 420 + } + , costingFunMemory = + ModelTwoArgumentsMaxSize + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramSubtractInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsMaxSize + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 100788 + , oneVariableLinearFunctionSlope = 420 + } + , costingFunMemory = + ModelTwoArgumentsMaxSize + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramMultiplyInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsMultipliedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 90434 + , oneVariableLinearFunctionSlope = 519 + } + , costingFunMemory = + ModelTwoArgumentsAddedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramDivideInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsConstAboveDiagonal + ModelConstantOrTwoArguments + { modelConstantOrTwoArgumentsConstant = 85848 + , modelConstantOrTwoArgumentsModel = + ModelTwoArgumentsMultipliedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 228465 + , oneVariableLinearFunctionSlope = 122 + } + } + , costingFunMemory = + ModelTwoArgumentsSubtractedSizes + ModelSubtractedSizes + { modelSubtractedSizesIntercept = 0 + , modelSubtractedSizesSlope = 1 + , modelSubtractedSizesMinimum = 1 + } + } + , paramQuotientInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsConstAboveDiagonal + ModelConstantOrTwoArguments + { modelConstantOrTwoArgumentsConstant = 85848 + , modelConstantOrTwoArgumentsModel = + ModelTwoArgumentsMultipliedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 228465 + , oneVariableLinearFunctionSlope = 122 + } + } + , costingFunMemory = + ModelTwoArgumentsSubtractedSizes + ModelSubtractedSizes + { modelSubtractedSizesIntercept = 0 + , modelSubtractedSizesSlope = 1 + , modelSubtractedSizesMinimum = 1 + } + } + , paramRemainderInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsConstAboveDiagonal + ModelConstantOrTwoArguments + { modelConstantOrTwoArgumentsConstant = 85848 + , modelConstantOrTwoArgumentsModel = + ModelTwoArgumentsMultipliedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 228465 + , oneVariableLinearFunctionSlope = 122 + } + } + , costingFunMemory = + ModelTwoArgumentsSubtractedSizes + ModelSubtractedSizes + { modelSubtractedSizesIntercept = 0 + , modelSubtractedSizesSlope = 1 + , modelSubtractedSizesMinimum = 1 + } + } + , paramModInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsConstAboveDiagonal + ModelConstantOrTwoArguments + { modelConstantOrTwoArgumentsConstant = 85848 + , modelConstantOrTwoArgumentsModel = + ModelTwoArgumentsMultipliedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 228465 + , oneVariableLinearFunctionSlope = 122 + } + } + , costingFunMemory = + ModelTwoArgumentsSubtractedSizes + ModelSubtractedSizes + { modelSubtractedSizesIntercept = 0 + , modelSubtractedSizesSlope = 1 + , modelSubtractedSizesMinimum = 1 + } + } + , paramEqualsInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsMinSize + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 51775 + , oneVariableLinearFunctionSlope = 558 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramLessThanInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsMinSize + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 44749 + , oneVariableLinearFunctionSlope = 541 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramLessThanEqualsInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsMinSize + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 43285 + , oneVariableLinearFunctionSlope = 552 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramAppendByteString = + CostingFun + { costingFunCpu = + ModelTwoArgumentsAddedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1000 + , oneVariableLinearFunctionSlope = 173 + } + , costingFunMemory = + ModelTwoArgumentsAddedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramConsByteString = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInY + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 72010 + , oneVariableLinearFunctionSlope = 178 + } + , costingFunMemory = + ModelTwoArgumentsAddedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramSliceByteString = + CostingFun + { costingFunCpu = + ModelThreeArgumentsLinearInZ + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 20467 + , oneVariableLinearFunctionSlope = 1 + } + , costingFunMemory = + ModelThreeArgumentsLinearInZ + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 4 + , oneVariableLinearFunctionSlope = 0 + } + } + , paramLengthOfByteString = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 22100 + , costingFunMemory = ModelOneArgumentConstantCost 10 + } + , paramIndexByteString = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 13169 + , costingFunMemory = ModelTwoArgumentsConstantCost 4 + } + , paramEqualsByteString = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearOnDiagonal + ModelConstantOrLinear + { modelConstantOrLinearConstant = 24548 + , modelConstantOrLinearIntercept = 29498 + , modelConstantOrLinearSlope = 38 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramLessThanByteString = + CostingFun + { costingFunCpu = + ModelTwoArgumentsMinSize + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 28999 + , oneVariableLinearFunctionSlope = 74 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramLessThanEqualsByteString = + CostingFun + { costingFunCpu = + ModelTwoArgumentsMinSize + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 28999 + , oneVariableLinearFunctionSlope = 74 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramSha2_256 = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 270652 + , oneVariableLinearFunctionSlope = 22588 + } + , costingFunMemory = ModelOneArgumentConstantCost 4 + } + , paramSha3_256 = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1457325 + , oneVariableLinearFunctionSlope = 64566 + } + , costingFunMemory = ModelOneArgumentConstantCost 4 + } + , paramBlake2b_256 = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 201305 + , oneVariableLinearFunctionSlope = 8356 + } + , costingFunMemory = ModelOneArgumentConstantCost 4 + } + , paramVerifyEd25519Signature = + CostingFun + { costingFunCpu = + ModelThreeArgumentsLinearInY + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 53384111 + , oneVariableLinearFunctionSlope = 14333 + } + , costingFunMemory = ModelThreeArgumentsConstantCost 10 + } + , paramVerifyEcdsaSecp256k1Signature = + CostingFun + { costingFunCpu = ModelThreeArgumentsConstantCost 43053543 + , costingFunMemory = ModelThreeArgumentsConstantCost 10 + } + , paramVerifySchnorrSecp256k1Signature = + CostingFun + { costingFunCpu = + ModelThreeArgumentsLinearInY + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 43574283 + , oneVariableLinearFunctionSlope = 26308 + } + , costingFunMemory = ModelThreeArgumentsConstantCost 10 + } + , paramAppendString = + CostingFun + { costingFunCpu = + ModelTwoArgumentsAddedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1000 + , oneVariableLinearFunctionSlope = 59957 + } + , costingFunMemory = + ModelTwoArgumentsAddedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 4 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramEqualsString = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearOnDiagonal + ModelConstantOrLinear + { modelConstantOrLinearConstant = 39184 + , modelConstantOrLinearIntercept = 1000 + , modelConstantOrLinearSlope = 60594 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramEncodeUtf8 = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1000 + , oneVariableLinearFunctionSlope = 42921 + } + , costingFunMemory = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 4 + , oneVariableLinearFunctionSlope = 2 + } + } + , paramDecodeUtf8 = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 91189 + , oneVariableLinearFunctionSlope = 769 + } + , costingFunMemory = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 4 + , oneVariableLinearFunctionSlope = 2 + } + } + , paramIfThenElse = + CostingFun + { costingFunCpu = ModelThreeArgumentsConstantCost 76049 + , costingFunMemory = ModelThreeArgumentsConstantCost 1 + } + , paramChooseUnit = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 61462 + , costingFunMemory = ModelTwoArgumentsConstantCost 4 + } + , paramTrace = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 59498 + , costingFunMemory = ModelTwoArgumentsConstantCost 32 + } + , paramFstPair = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 141895 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramSndPair = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 141992 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramChooseList = + CostingFun + { costingFunCpu = ModelThreeArgumentsConstantCost 132994 + , costingFunMemory = ModelThreeArgumentsConstantCost 32 + } + , paramMkCons = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 72362 + , costingFunMemory = ModelTwoArgumentsConstantCost 32 + } + , paramHeadList = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 83150 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramTailList = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 81663 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramNullList = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 74433 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramChooseData = + CostingFun + { costingFunCpu = ModelSixArgumentsConstantCost 94375 + , costingFunMemory = ModelSixArgumentsConstantCost 32 + } + , paramConstrData = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 22151 + , costingFunMemory = ModelTwoArgumentsConstantCost 32 + } + , paramMapData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 68246 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramListData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 33852 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramIData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 15299 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramBData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 11183 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramUnConstrData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 24588 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramUnMapData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 24623 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramUnListData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 25933 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramUnIData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 20744 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramUnBData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 20142 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramEqualsData = + CostingFun + { costingFunCpu = + ModelTwoArgumentsMinSize + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 898148 + , oneVariableLinearFunctionSlope = 27279 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramMkPairData = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 11546 + , costingFunMemory = ModelTwoArgumentsConstantCost 32 + } + , paramMkNilData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 7243 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramMkNilPairData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 7391 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramSerialiseData = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 955506 + , oneVariableLinearFunctionSlope = 213312 + } + , costingFunMemory = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 2 + } + } + , paramBls12_381_G1_add = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 962335 + , costingFunMemory = ModelTwoArgumentsConstantCost 18 + } + , paramBls12_381_G1_neg = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 267929 + , costingFunMemory = ModelOneArgumentConstantCost 18 + } + , paramBls12_381_G1_scalarMul = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 76433006 + , oneVariableLinearFunctionSlope = 8868 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 18 + } + , paramBls12_381_G1_multiScalarMul = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 321837444 + , oneVariableLinearFunctionSlope = 25087669 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 18 + } + , paramBls12_381_G1_equal = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 442008 + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramBls12_381_G1_compress = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 2780678 + , costingFunMemory = ModelOneArgumentConstantCost 6 + } + , paramBls12_381_G1_uncompress = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 52948122 + , costingFunMemory = ModelOneArgumentConstantCost 18 + } + , paramBls12_381_G1_hashToGroup = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 52538055 + , oneVariableLinearFunctionSlope = 3756 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 18 + } + , paramBls12_381_G2_add = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 1995836 + , costingFunMemory = ModelTwoArgumentsConstantCost 36 + } + , paramBls12_381_G2_neg = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 284546 + , costingFunMemory = ModelOneArgumentConstantCost 36 + } + , paramBls12_381_G2_scalarMul = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 158221314 + , oneVariableLinearFunctionSlope = 26549 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 36 + } + , paramBls12_381_G2_equal = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 901022 + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramBls12_381_G2_multiScalarMul = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 617887431 + , oneVariableLinearFunctionSlope = 67302824 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 36 + } + , paramBls12_381_G2_compress = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 3227919 + , costingFunMemory = ModelOneArgumentConstantCost 12 + } + , paramBls12_381_G2_uncompress = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 74698472 + , costingFunMemory = ModelOneArgumentConstantCost 36 + } + , paramBls12_381_G2_hashToGroup = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 166917843 + , oneVariableLinearFunctionSlope = 4307 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 36 + } + , paramBls12_381_millerLoop = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 254006273 + , costingFunMemory = ModelTwoArgumentsConstantCost 72 + } + , paramBls12_381_mulMlResult = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 2174038 + , costingFunMemory = ModelTwoArgumentsConstantCost 72 + } + , paramBls12_381_finalVerify = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 333849714 + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramKeccak_256 = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 2261318 + , oneVariableLinearFunctionSlope = 64571 + } + , costingFunMemory = ModelOneArgumentConstantCost 4 + } + , paramBlake2b_224 = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 207616 + , oneVariableLinearFunctionSlope = 8310 + } + , costingFunMemory = ModelOneArgumentConstantCost 4 + } + , paramIntegerToByteString = + CostingFun + { costingFunCpu = + ModelThreeArgumentsQuadraticInZ + OneVariableQuadraticFunction + { oneVariableQuadraticFunctionC0 = 1293828 + , oneVariableQuadraticFunctionC1 = 28716 + , oneVariableQuadraticFunctionC2 = 63 + } + , costingFunMemory = + ModelThreeArgumentsLiteralInYOrLinearInZ + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramByteStringToInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsQuadraticInY + OneVariableQuadraticFunction + { oneVariableQuadraticFunctionC0 = 1006041 + , oneVariableQuadraticFunctionC1 = 43623 + , oneVariableQuadraticFunctionC2 = 251 + } + , costingFunMemory = + ModelTwoArgumentsLinearInY + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramAndByteString = + CostingFun + { costingFunCpu = + ModelThreeArgumentsLinearInYAndZ + TwoVariableLinearFunction + { twoVariableLinearFunctionIntercept = 100181 + , twoVariableLinearFunctionSlope1 = 726 + , twoVariableLinearFunctionSlope2 = 719 + } + , costingFunMemory = + ModelThreeArgumentsLinearInMaxYZ + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramOrByteString = + CostingFun + { costingFunCpu = + ModelThreeArgumentsLinearInYAndZ + TwoVariableLinearFunction + { twoVariableLinearFunctionIntercept = 100181 + , twoVariableLinearFunctionSlope1 = 726 + , twoVariableLinearFunctionSlope2 = 719 + } + , costingFunMemory = + ModelThreeArgumentsLinearInMaxYZ + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramXorByteString = + CostingFun + { costingFunCpu = + ModelThreeArgumentsLinearInYAndZ + TwoVariableLinearFunction + { twoVariableLinearFunctionIntercept = 100181 + , twoVariableLinearFunctionSlope1 = 726 + , twoVariableLinearFunctionSlope2 = 719 + } + , costingFunMemory = + ModelThreeArgumentsLinearInMaxYZ + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramComplementByteString = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 107878 + , oneVariableLinearFunctionSlope = 680 + } + , costingFunMemory = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramReadBit = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 95336 + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramWriteBits = + CostingFun + { costingFunCpu = + ModelThreeArgumentsLinearInY + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 281145 + , oneVariableLinearFunctionSlope = 18848 + } + , costingFunMemory = + ModelThreeArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramReplicateByte = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 180194 + , oneVariableLinearFunctionSlope = 159 + } + , costingFunMemory = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramShiftByteString = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 158519 + , oneVariableLinearFunctionSlope = 8942 + } + , costingFunMemory = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramRotateByteString = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 159378 + , oneVariableLinearFunctionSlope = 8813 + } + , costingFunMemory = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramCountSetBits = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 107490 + , oneVariableLinearFunctionSlope = 3298 + } + , costingFunMemory = ModelOneArgumentConstantCost 1 + } + , paramFindFirstSetBit = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 106057 + , oneVariableLinearFunctionSlope = 655 + } + , costingFunMemory = ModelOneArgumentConstantCost 1 + } + , paramRipemd_160 = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1964219 + , oneVariableLinearFunctionSlope = 24520 + } + , costingFunMemory = ModelOneArgumentConstantCost 3 + } + , paramExpModInteger = + CostingFun + { costingFunCpu = + ModelThreeArgumentsExpModCost + ExpModCostingFunction + { coefficient00 = 607153 + , coefficient11 = 231697 + , coefficient12 = 53144 + } + , costingFunMemory = + ModelThreeArgumentsLinearInZ + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramDropList = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 116711 + , oneVariableLinearFunctionSlope = 1957 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 4 + } + , paramLengthOfArray = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 231883 + , costingFunMemory = ModelOneArgumentConstantCost 10 + } + , paramListToArray = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1000 + , oneVariableLinearFunctionSlope = 24838 + } + , costingFunMemory = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 7 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramIndexArray = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 232010 + , costingFunMemory = ModelTwoArgumentsConstantCost 32 + } + , paramLookupCoin = + CostingFun + { costingFunCpu = + ModelThreeArgumentsLinearInZ + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 219951 + , oneVariableLinearFunctionSlope = 9444 + } + , costingFunMemory = ModelThreeArgumentsConstantCost 1 + } + , paramValueContains = + CostingFun + { costingFunCpu = + ModelTwoArgumentsConstAboveDiagonal + ModelConstantOrTwoArguments + { modelConstantOrTwoArgumentsConstant = 213283 + , modelConstantOrTwoArgumentsModel = + ModelTwoArgumentsLinearInXAndY + TwoVariableLinearFunction + { twoVariableLinearFunctionIntercept = 618401 + , twoVariableLinearFunctionSlope1 = 1998 + , twoVariableLinearFunctionSlope2 = 28258 + } + } + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramValueData = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1000 + , oneVariableLinearFunctionSlope = 38159 + } + , costingFunMemory = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 2 + , oneVariableLinearFunctionSlope = 22 + } + } + , paramUnValueData = + CostingFun + { costingFunCpu = + ModelOneArgumentQuadraticInX + OneVariableQuadraticFunction + { oneVariableQuadraticFunctionC0 = 1000 + , oneVariableQuadraticFunctionC1 = 95933 + , oneVariableQuadraticFunctionC2 = 1 + } + , costingFunMemory = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 11 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramInsertCoin = + CostingFun + { costingFunCpu = + ModelFourArgumentsLinearInU + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 356924 + , oneVariableLinearFunctionSlope = 18413 + } + , costingFunMemory = + ModelFourArgumentsLinearInU + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 45 + , oneVariableLinearFunctionSlope = 21 + } + } + , paramUnionValue = + CostingFun + { costingFunCpu = + ModelTwoArgumentsWithInteractionInXAndY + TwoVariableWithInteractionFunction + { twoVariableWithInteractionFunctionC00 = 1000 + , twoVariableWithInteractionFunctionC10 = 172116 + , twoVariableWithInteractionFunctionC01 = 183150 + , twoVariableWithInteractionFunctionC11 = 6 + } + , costingFunMemory = + ModelTwoArgumentsAddedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 24 + , oneVariableLinearFunctionSlope = 21 + } + } + , paramScaleValue = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInY + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1000 + , oneVariableLinearFunctionSlope = 277577 + } + , costingFunMemory = + ModelTwoArgumentsLinearInY + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 12 + , oneVariableLinearFunctionSlope = 21 + } + } + } diff --git a/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/CostModel/BuiltinCostModelC.hs b/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/CostModel/BuiltinCostModelC.hs new file mode 100644 index 00000000000..cd641e32feb --- /dev/null +++ b/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/CostModel/BuiltinCostModelC.hs @@ -0,0 +1,1020 @@ +-- This file is auto-generated by the generate-cost-model executable. +-- Do not edit this file manually. + +module PlutusCore.Evaluation.Machine.CostModel.BuiltinCostModelC (builtinCostModelC) where + +import PlutusCore.Evaluation.Machine.BuiltinCostModel + +builtinCostModelC :: BuiltinCostModel +builtinCostModelC = + BuiltinCostModelBase + { paramAddInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsMaxSize + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 100788 + , oneVariableLinearFunctionSlope = 420 + } + , costingFunMemory = + ModelTwoArgumentsMaxSize + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramSubtractInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsMaxSize + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 100788 + , oneVariableLinearFunctionSlope = 420 + } + , costingFunMemory = + ModelTwoArgumentsMaxSize + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramMultiplyInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsMultipliedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 90434 + , oneVariableLinearFunctionSlope = 519 + } + , costingFunMemory = + ModelTwoArgumentsAddedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramDivideInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsConstAboveDiagonal + ModelConstantOrTwoArguments + { modelConstantOrTwoArgumentsConstant = 85848 + , modelConstantOrTwoArgumentsModel = + ModelTwoArgumentsQuadraticInXAndY + TwoVariableQuadraticFunction + { twoVariableQuadraticFunctionMinimum = 85848 + , twoVariableQuadraticFunctionC00 = 123203 + , twoVariableQuadraticFunctionC10 = 1716 + , twoVariableQuadraticFunctionC01 = 7305 + , twoVariableQuadraticFunctionC20 = 57 + , twoVariableQuadraticFunctionC11 = 549 + , twoVariableQuadraticFunctionC02 = -900 + } + } + , costingFunMemory = + ModelTwoArgumentsSubtractedSizes + ModelSubtractedSizes + { modelSubtractedSizesIntercept = 0 + , modelSubtractedSizesSlope = 1 + , modelSubtractedSizesMinimum = 1 + } + } + , paramQuotientInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsConstAboveDiagonal + ModelConstantOrTwoArguments + { modelConstantOrTwoArgumentsConstant = 85848 + , modelConstantOrTwoArgumentsModel = + ModelTwoArgumentsQuadraticInXAndY + TwoVariableQuadraticFunction + { twoVariableQuadraticFunctionMinimum = 85848 + , twoVariableQuadraticFunctionC00 = 123203 + , twoVariableQuadraticFunctionC10 = 1716 + , twoVariableQuadraticFunctionC01 = 7305 + , twoVariableQuadraticFunctionC20 = 57 + , twoVariableQuadraticFunctionC11 = 549 + , twoVariableQuadraticFunctionC02 = -900 + } + } + , costingFunMemory = + ModelTwoArgumentsSubtractedSizes + ModelSubtractedSizes + { modelSubtractedSizesIntercept = 0 + , modelSubtractedSizesSlope = 1 + , modelSubtractedSizesMinimum = 1 + } + } + , paramRemainderInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsConstAboveDiagonal + ModelConstantOrTwoArguments + { modelConstantOrTwoArgumentsConstant = 85848 + , modelConstantOrTwoArgumentsModel = + ModelTwoArgumentsQuadraticInXAndY + TwoVariableQuadraticFunction + { twoVariableQuadraticFunctionMinimum = 85848 + , twoVariableQuadraticFunctionC00 = 123203 + , twoVariableQuadraticFunctionC10 = 1716 + , twoVariableQuadraticFunctionC01 = 7305 + , twoVariableQuadraticFunctionC20 = 57 + , twoVariableQuadraticFunctionC11 = 549 + , twoVariableQuadraticFunctionC02 = -900 + } + } + , costingFunMemory = + ModelTwoArgumentsLinearInY + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramModInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsConstAboveDiagonal + ModelConstantOrTwoArguments + { modelConstantOrTwoArgumentsConstant = 85848 + , modelConstantOrTwoArgumentsModel = + ModelTwoArgumentsQuadraticInXAndY + TwoVariableQuadraticFunction + { twoVariableQuadraticFunctionMinimum = 85848 + , twoVariableQuadraticFunctionC00 = 123203 + , twoVariableQuadraticFunctionC10 = 1716 + , twoVariableQuadraticFunctionC01 = 7305 + , twoVariableQuadraticFunctionC20 = 57 + , twoVariableQuadraticFunctionC11 = 549 + , twoVariableQuadraticFunctionC02 = -900 + } + } + , costingFunMemory = + ModelTwoArgumentsLinearInY + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramEqualsInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsMinSize + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 51775 + , oneVariableLinearFunctionSlope = 558 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramLessThanInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsMinSize + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 44749 + , oneVariableLinearFunctionSlope = 541 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramLessThanEqualsInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsMinSize + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 43285 + , oneVariableLinearFunctionSlope = 552 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramAppendByteString = + CostingFun + { costingFunCpu = + ModelTwoArgumentsAddedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1000 + , oneVariableLinearFunctionSlope = 173 + } + , costingFunMemory = + ModelTwoArgumentsAddedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramConsByteString = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInY + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 72010 + , oneVariableLinearFunctionSlope = 178 + } + , costingFunMemory = + ModelTwoArgumentsAddedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramSliceByteString = + CostingFun + { costingFunCpu = + ModelThreeArgumentsLinearInZ + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 20467 + , oneVariableLinearFunctionSlope = 1 + } + , costingFunMemory = + ModelThreeArgumentsLinearInZ + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 4 + , oneVariableLinearFunctionSlope = 0 + } + } + , paramLengthOfByteString = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 22100 + , costingFunMemory = ModelOneArgumentConstantCost 10 + } + , paramIndexByteString = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 13169 + , costingFunMemory = ModelTwoArgumentsConstantCost 4 + } + , paramEqualsByteString = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearOnDiagonal + ModelConstantOrLinear + { modelConstantOrLinearConstant = 24548 + , modelConstantOrLinearIntercept = 29498 + , modelConstantOrLinearSlope = 38 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramLessThanByteString = + CostingFun + { costingFunCpu = + ModelTwoArgumentsMinSize + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 28999 + , oneVariableLinearFunctionSlope = 74 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramLessThanEqualsByteString = + CostingFun + { costingFunCpu = + ModelTwoArgumentsMinSize + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 28999 + , oneVariableLinearFunctionSlope = 74 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramSha2_256 = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 270652 + , oneVariableLinearFunctionSlope = 22588 + } + , costingFunMemory = ModelOneArgumentConstantCost 4 + } + , paramSha3_256 = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1457325 + , oneVariableLinearFunctionSlope = 64566 + } + , costingFunMemory = ModelOneArgumentConstantCost 4 + } + , paramBlake2b_256 = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 201305 + , oneVariableLinearFunctionSlope = 8356 + } + , costingFunMemory = ModelOneArgumentConstantCost 4 + } + , paramVerifyEd25519Signature = + CostingFun + { costingFunCpu = + ModelThreeArgumentsLinearInY + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 53384111 + , oneVariableLinearFunctionSlope = 14333 + } + , costingFunMemory = ModelThreeArgumentsConstantCost 10 + } + , paramVerifyEcdsaSecp256k1Signature = + CostingFun + { costingFunCpu = ModelThreeArgumentsConstantCost 43053543 + , costingFunMemory = ModelThreeArgumentsConstantCost 10 + } + , paramVerifySchnorrSecp256k1Signature = + CostingFun + { costingFunCpu = + ModelThreeArgumentsLinearInY + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 43574283 + , oneVariableLinearFunctionSlope = 26308 + } + , costingFunMemory = ModelThreeArgumentsConstantCost 10 + } + , paramAppendString = + CostingFun + { costingFunCpu = + ModelTwoArgumentsAddedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1000 + , oneVariableLinearFunctionSlope = 59957 + } + , costingFunMemory = + ModelTwoArgumentsAddedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 4 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramEqualsString = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearOnDiagonal + ModelConstantOrLinear + { modelConstantOrLinearConstant = 39184 + , modelConstantOrLinearIntercept = 1000 + , modelConstantOrLinearSlope = 60594 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramEncodeUtf8 = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1000 + , oneVariableLinearFunctionSlope = 42921 + } + , costingFunMemory = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 4 + , oneVariableLinearFunctionSlope = 2 + } + } + , paramDecodeUtf8 = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 91189 + , oneVariableLinearFunctionSlope = 769 + } + , costingFunMemory = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 4 + , oneVariableLinearFunctionSlope = 2 + } + } + , paramIfThenElse = + CostingFun + { costingFunCpu = ModelThreeArgumentsConstantCost 76049 + , costingFunMemory = ModelThreeArgumentsConstantCost 1 + } + , paramChooseUnit = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 61462 + , costingFunMemory = ModelTwoArgumentsConstantCost 4 + } + , paramTrace = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 59498 + , costingFunMemory = ModelTwoArgumentsConstantCost 32 + } + , paramFstPair = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 141895 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramSndPair = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 141992 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramChooseList = + CostingFun + { costingFunCpu = ModelThreeArgumentsConstantCost 132994 + , costingFunMemory = ModelThreeArgumentsConstantCost 32 + } + , paramMkCons = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 72362 + , costingFunMemory = ModelTwoArgumentsConstantCost 32 + } + , paramHeadList = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 83150 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramTailList = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 81663 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramNullList = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 74433 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramChooseData = + CostingFun + { costingFunCpu = ModelSixArgumentsConstantCost 94375 + , costingFunMemory = ModelSixArgumentsConstantCost 32 + } + , paramConstrData = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 22151 + , costingFunMemory = ModelTwoArgumentsConstantCost 32 + } + , paramMapData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 68246 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramListData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 33852 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramIData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 15299 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramBData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 11183 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramUnConstrData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 24588 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramUnMapData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 24623 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramUnListData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 25933 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramUnIData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 20744 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramUnBData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 20142 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramEqualsData = + CostingFun + { costingFunCpu = + ModelTwoArgumentsMinSize + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 898148 + , oneVariableLinearFunctionSlope = 27279 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramMkPairData = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 11546 + , costingFunMemory = ModelTwoArgumentsConstantCost 32 + } + , paramMkNilData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 7243 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramMkNilPairData = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 7391 + , costingFunMemory = ModelOneArgumentConstantCost 32 + } + , paramSerialiseData = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 955506 + , oneVariableLinearFunctionSlope = 213312 + } + , costingFunMemory = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 2 + } + } + , paramBls12_381_G1_add = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 962335 + , costingFunMemory = ModelTwoArgumentsConstantCost 18 + } + , paramBls12_381_G1_neg = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 267929 + , costingFunMemory = ModelOneArgumentConstantCost 18 + } + , paramBls12_381_G1_scalarMul = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 76433006 + , oneVariableLinearFunctionSlope = 8868 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 18 + } + , paramBls12_381_G1_multiScalarMul = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 321837444 + , oneVariableLinearFunctionSlope = 25087669 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 18 + } + , paramBls12_381_G1_equal = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 442008 + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramBls12_381_G1_compress = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 2780678 + , costingFunMemory = ModelOneArgumentConstantCost 6 + } + , paramBls12_381_G1_uncompress = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 52948122 + , costingFunMemory = ModelOneArgumentConstantCost 18 + } + , paramBls12_381_G1_hashToGroup = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 52538055 + , oneVariableLinearFunctionSlope = 3756 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 18 + } + , paramBls12_381_G2_add = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 1995836 + , costingFunMemory = ModelTwoArgumentsConstantCost 36 + } + , paramBls12_381_G2_neg = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 284546 + , costingFunMemory = ModelOneArgumentConstantCost 36 + } + , paramBls12_381_G2_scalarMul = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 158221314 + , oneVariableLinearFunctionSlope = 26549 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 36 + } + , paramBls12_381_G2_equal = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 901022 + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramBls12_381_G2_multiScalarMul = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 617887431 + , oneVariableLinearFunctionSlope = 67302824 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 36 + } + , paramBls12_381_G2_compress = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 3227919 + , costingFunMemory = ModelOneArgumentConstantCost 12 + } + , paramBls12_381_G2_uncompress = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 74698472 + , costingFunMemory = ModelOneArgumentConstantCost 36 + } + , paramBls12_381_G2_hashToGroup = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 166917843 + , oneVariableLinearFunctionSlope = 4307 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 36 + } + , paramBls12_381_millerLoop = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 254006273 + , costingFunMemory = ModelTwoArgumentsConstantCost 72 + } + , paramBls12_381_mulMlResult = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 2174038 + , costingFunMemory = ModelTwoArgumentsConstantCost 72 + } + , paramBls12_381_finalVerify = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 333849714 + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramKeccak_256 = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 2261318 + , oneVariableLinearFunctionSlope = 64571 + } + , costingFunMemory = ModelOneArgumentConstantCost 4 + } + , paramBlake2b_224 = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 207616 + , oneVariableLinearFunctionSlope = 8310 + } + , costingFunMemory = ModelOneArgumentConstantCost 4 + } + , paramIntegerToByteString = + CostingFun + { costingFunCpu = + ModelThreeArgumentsQuadraticInZ + OneVariableQuadraticFunction + { oneVariableQuadraticFunctionC0 = 1293828 + , oneVariableQuadraticFunctionC1 = 28716 + , oneVariableQuadraticFunctionC2 = 63 + } + , costingFunMemory = + ModelThreeArgumentsLiteralInYOrLinearInZ + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramByteStringToInteger = + CostingFun + { costingFunCpu = + ModelTwoArgumentsQuadraticInY + OneVariableQuadraticFunction + { oneVariableQuadraticFunctionC0 = 1006041 + , oneVariableQuadraticFunctionC1 = 43623 + , oneVariableQuadraticFunctionC2 = 251 + } + , costingFunMemory = + ModelTwoArgumentsLinearInY + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramAndByteString = + CostingFun + { costingFunCpu = + ModelThreeArgumentsLinearInYAndZ + TwoVariableLinearFunction + { twoVariableLinearFunctionIntercept = 100181 + , twoVariableLinearFunctionSlope1 = 726 + , twoVariableLinearFunctionSlope2 = 719 + } + , costingFunMemory = + ModelThreeArgumentsLinearInMaxYZ + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramOrByteString = + CostingFun + { costingFunCpu = + ModelThreeArgumentsLinearInYAndZ + TwoVariableLinearFunction + { twoVariableLinearFunctionIntercept = 100181 + , twoVariableLinearFunctionSlope1 = 726 + , twoVariableLinearFunctionSlope2 = 719 + } + , costingFunMemory = + ModelThreeArgumentsLinearInMaxYZ + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramXorByteString = + CostingFun + { costingFunCpu = + ModelThreeArgumentsLinearInYAndZ + TwoVariableLinearFunction + { twoVariableLinearFunctionIntercept = 100181 + , twoVariableLinearFunctionSlope1 = 726 + , twoVariableLinearFunctionSlope2 = 719 + } + , costingFunMemory = + ModelThreeArgumentsLinearInMaxYZ + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramComplementByteString = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 107878 + , oneVariableLinearFunctionSlope = 680 + } + , costingFunMemory = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramReadBit = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 95336 + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramWriteBits = + CostingFun + { costingFunCpu = + ModelThreeArgumentsLinearInY + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 281145 + , oneVariableLinearFunctionSlope = 18848 + } + , costingFunMemory = + ModelThreeArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramReplicateByte = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 180194 + , oneVariableLinearFunctionSlope = 159 + } + , costingFunMemory = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramShiftByteString = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 158519 + , oneVariableLinearFunctionSlope = 8942 + } + , costingFunMemory = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramRotateByteString = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 159378 + , oneVariableLinearFunctionSlope = 8813 + } + , costingFunMemory = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramCountSetBits = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 107490 + , oneVariableLinearFunctionSlope = 3298 + } + , costingFunMemory = ModelOneArgumentConstantCost 1 + } + , paramFindFirstSetBit = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 106057 + , oneVariableLinearFunctionSlope = 655 + } + , costingFunMemory = ModelOneArgumentConstantCost 1 + } + , paramRipemd_160 = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1964219 + , oneVariableLinearFunctionSlope = 24520 + } + , costingFunMemory = ModelOneArgumentConstantCost 3 + } + , paramExpModInteger = + CostingFun + { costingFunCpu = + ModelThreeArgumentsExpModCost + ExpModCostingFunction + { coefficient00 = 607153 + , coefficient11 = 231697 + , coefficient12 = 53144 + } + , costingFunMemory = + ModelThreeArgumentsLinearInZ + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 0 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramDropList = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 116711 + , oneVariableLinearFunctionSlope = 1957 + } + , costingFunMemory = ModelTwoArgumentsConstantCost 4 + } + , paramLengthOfArray = + CostingFun + { costingFunCpu = ModelOneArgumentConstantCost 231883 + , costingFunMemory = ModelOneArgumentConstantCost 10 + } + , paramListToArray = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1000 + , oneVariableLinearFunctionSlope = 24838 + } + , costingFunMemory = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 7 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramIndexArray = + CostingFun + { costingFunCpu = ModelTwoArgumentsConstantCost 232010 + , costingFunMemory = ModelTwoArgumentsConstantCost 32 + } + , paramLookupCoin = + CostingFun + { costingFunCpu = + ModelThreeArgumentsLinearInZ + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 219951 + , oneVariableLinearFunctionSlope = 9444 + } + , costingFunMemory = ModelThreeArgumentsConstantCost 1 + } + , paramValueContains = + CostingFun + { costingFunCpu = + ModelTwoArgumentsConstAboveDiagonal + ModelConstantOrTwoArguments + { modelConstantOrTwoArgumentsConstant = 213283 + , modelConstantOrTwoArgumentsModel = + ModelTwoArgumentsLinearInXAndY + TwoVariableLinearFunction + { twoVariableLinearFunctionIntercept = 618401 + , twoVariableLinearFunctionSlope1 = 1998 + , twoVariableLinearFunctionSlope2 = 28258 + } + } + , costingFunMemory = ModelTwoArgumentsConstantCost 1 + } + , paramValueData = + CostingFun + { costingFunCpu = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1000 + , oneVariableLinearFunctionSlope = 38159 + } + , costingFunMemory = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 2 + , oneVariableLinearFunctionSlope = 22 + } + } + , paramUnValueData = + CostingFun + { costingFunCpu = + ModelOneArgumentQuadraticInX + OneVariableQuadraticFunction + { oneVariableQuadraticFunctionC0 = 1000 + , oneVariableQuadraticFunctionC1 = 95933 + , oneVariableQuadraticFunctionC2 = 1 + } + , costingFunMemory = + ModelOneArgumentLinearInX + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 11 + , oneVariableLinearFunctionSlope = 1 + } + } + , paramInsertCoin = + CostingFun + { costingFunCpu = + ModelFourArgumentsLinearInU + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 356924 + , oneVariableLinearFunctionSlope = 18413 + } + , costingFunMemory = + ModelFourArgumentsLinearInU + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 45 + , oneVariableLinearFunctionSlope = 21 + } + } + , paramUnionValue = + CostingFun + { costingFunCpu = + ModelTwoArgumentsWithInteractionInXAndY + TwoVariableWithInteractionFunction + { twoVariableWithInteractionFunctionC00 = 1000 + , twoVariableWithInteractionFunctionC10 = 172116 + , twoVariableWithInteractionFunctionC01 = 183150 + , twoVariableWithInteractionFunctionC11 = 6 + } + , costingFunMemory = + ModelTwoArgumentsAddedSizes + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 24 + , oneVariableLinearFunctionSlope = 21 + } + } + , paramScaleValue = + CostingFun + { costingFunCpu = + ModelTwoArgumentsLinearInY + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 1000 + , oneVariableLinearFunctionSlope = 277577 + } + , costingFunMemory = + ModelTwoArgumentsLinearInY + OneVariableLinearFunction + { oneVariableLinearFunctionIntercept = 12 + , oneVariableLinearFunctionSlope = 21 + } + } + } diff --git a/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/CostModel/CekMachineCostsA.hs b/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/CostModel/CekMachineCostsA.hs new file mode 100644 index 00000000000..50fe9338987 --- /dev/null +++ b/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/CostModel/CekMachineCostsA.hs @@ -0,0 +1,20 @@ +module PlutusCore.Evaluation.Machine.CostModel.CekMachineCostsA (cekMachineCostsA) where + +import Data.Functor.Identity +import PlutusCore.Evaluation.Machine.ExBudget +import UntypedPlutusCore.Evaluation.Machine.Cek.CekMachineCosts + +cekMachineCostsA :: CekMachineCosts +cekMachineCostsA = + CekMachineCostsBase + { cekStartupCost = Identity $ ExBudget 100 100 + , cekVarCost = Identity $ ExBudget 23000 100 + , cekConstCost = Identity $ ExBudget 23000 100 + , cekLamCost = Identity $ ExBudget 23000 100 + , cekDelayCost = Identity $ ExBudget 23000 100 + , cekForceCost = Identity $ ExBudget 23000 100 + , cekApplyCost = Identity $ ExBudget 23000 100 + , cekBuiltinCost = Identity $ ExBudget 23000 100 + , cekConstrCost = Identity $ ExBudget 23000 100 + , cekCaseCost = Identity $ ExBudget 23000 100 + } diff --git a/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/CostModel/CekMachineCostsB.hs b/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/CostModel/CekMachineCostsB.hs new file mode 100644 index 00000000000..19ffcdb8e33 --- /dev/null +++ b/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/CostModel/CekMachineCostsB.hs @@ -0,0 +1,20 @@ +module PlutusCore.Evaluation.Machine.CostModel.CekMachineCostsB (cekMachineCostsB) where + +import Data.Functor.Identity +import PlutusCore.Evaluation.Machine.ExBudget +import UntypedPlutusCore.Evaluation.Machine.Cek.CekMachineCosts + +cekMachineCostsB :: CekMachineCosts +cekMachineCostsB = + CekMachineCostsBase + { cekStartupCost = Identity $ ExBudget 100 100 + , cekVarCost = Identity $ ExBudget 16000 100 + , cekConstCost = Identity $ ExBudget 16000 100 + , cekLamCost = Identity $ ExBudget 16000 100 + , cekDelayCost = Identity $ ExBudget 16000 100 + , cekForceCost = Identity $ ExBudget 16000 100 + , cekApplyCost = Identity $ ExBudget 16000 100 + , cekBuiltinCost = Identity $ ExBudget 16000 100 + , cekConstrCost = Identity $ ExBudget 16000 100 + , cekCaseCost = Identity $ ExBudget 16000 100 + } diff --git a/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/CostModel/CekMachineCostsC.hs b/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/CostModel/CekMachineCostsC.hs new file mode 100644 index 00000000000..91189a99a06 --- /dev/null +++ b/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/CostModel/CekMachineCostsC.hs @@ -0,0 +1,20 @@ +module PlutusCore.Evaluation.Machine.CostModel.CekMachineCostsC (cekMachineCostsC) where + +import Data.Functor.Identity +import PlutusCore.Evaluation.Machine.ExBudget +import UntypedPlutusCore.Evaluation.Machine.Cek.CekMachineCosts + +cekMachineCostsC :: CekMachineCosts +cekMachineCostsC = + CekMachineCostsBase + { cekStartupCost = Identity $ ExBudget 100 100 + , cekVarCost = Identity $ ExBudget 16000 100 + , cekConstCost = Identity $ ExBudget 16000 100 + , cekLamCost = Identity $ ExBudget 16000 100 + , cekDelayCost = Identity $ ExBudget 16000 100 + , cekForceCost = Identity $ ExBudget 16000 100 + , cekApplyCost = Identity $ ExBudget 16000 100 + , cekBuiltinCost = Identity $ ExBudget 16000 100 + , cekConstrCost = Identity $ ExBudget 16000 100 + , cekCaseCost = Identity $ ExBudget 16000 100 + } diff --git a/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/ExBudgetingDefaults.hs b/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/ExBudgetingDefaults.hs index 0b526fa1f47..6a8179605df 100644 --- a/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/ExBudgetingDefaults.hs +++ b/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/ExBudgetingDefaults.hs @@ -1,7 +1,6 @@ -- editorconfig-checker-disable-file {-# LANGUAGE DataKinds #-} {-# LANGUAGE LambdaCase #-} -{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} module PlutusCore.Evaluation.Machine.ExBudgetingDefaults @@ -23,7 +22,6 @@ where import PlutusCore.Builtin -import PlutusCore.DataFilePaths qualified as DFP import PlutusCore.Default import PlutusCore.Evaluation.Machine.BuiltinCostModel import PlutusCore.Evaluation.Machine.CostModelInterface @@ -32,7 +30,13 @@ import PlutusCore.Evaluation.Machine.MachineParameters import UntypedPlutusCore.Evaluation.Machine.Cek.CekMachineCosts import UntypedPlutusCore.Evaluation.Machine.Cek.Internal -import Data.Aeson.THReader +-- Import generated cost model modules +import PlutusCore.Evaluation.Machine.CostModel.BuiltinCostModelA (builtinCostModelA) +import PlutusCore.Evaluation.Machine.CostModel.BuiltinCostModelB (builtinCostModelB) +import PlutusCore.Evaluation.Machine.CostModel.BuiltinCostModelC (builtinCostModelC) +import PlutusCore.Evaluation.Machine.CostModel.CekMachineCostsA (cekMachineCostsA) +import PlutusCore.Evaluation.Machine.CostModel.CekMachineCostsB (cekMachineCostsB) +import PlutusCore.Evaluation.Machine.CostModel.CekMachineCostsC (cekMachineCostsC) -- Not using 'noinline' from "GHC.Exts", because our CI was unable to find it there, somehow. import GHC.Magic (noinline) @@ -41,31 +45,26 @@ import PlutusPrelude {- Note [Modifying the cost model] When the Haskell representation of the cost model is changed, for example by adding a new builtin or changing the name of an existing one, - readJSONFromFile will fail when it tries to read a JSON file generated using - the previous version. When this happens, uncomment the three lines below (and - comment out the three above) then rerun + the generated Haskell modules will need to be regenerated. When this happens, + you may need to temporarily use default values. To do this, uncomment the three + lines below and comment out the import from the generated module, then rerun cabal run plutus-core:generate-cost-model + with appropriate output file specified (e.g., -o BuiltinCostModelC). (You may also need to add 'data-default' to the 'build-depends' for the - library in plutus-core.cabal). This will generate a new JSON file filled with - default values. After that, restore this file to its previous state and then - run "generate-cost-model" again to fill in the JSON file with the correct - values (assuming that suitable benchmarking data is in benching.csv and that + library in plutus-core.cabal). This will generate a new Haskell module filled with + the correct values (assuming that suitable benchmarking data is in benching.csv and that models.R contains R code to generate cost models for any new functions). - - Alternatively, modify the appropriate 'builtinCostModelX.json' by hand so - that it matches the new format. -} -- import Data.Default --- defaultBuiltinCostModel :: BuiltinCostModel --- defaultBuiltinCostModel = def +-- builtinCostModelVariantA :: BuiltinCostModel +-- builtinCostModelVariantA = def -- | The default cost model for built-in functions (variant A) builtinCostModelVariantA :: BuiltinCostModel -builtinCostModelVariantA = - $$(readJSONFromFile DFP.builtinCostModelFileA) +builtinCostModelVariantA = builtinCostModelA -- This is a huge record, inlining it is wasteful. {-# OPAQUE builtinCostModelVariantA #-} @@ -75,8 +74,7 @@ appears faster than 'CekMachineCosts' that we get in production after applying the costing parameters provided by the ledger. -} -- | Default costs for CEK machine instructions (variant A) cekMachineCostsVariantA :: CekMachineCosts -cekMachineCostsVariantA = - $$(readJSONFromFile DFP.cekMachineCostsFileA) +cekMachineCostsVariantA = cekMachineCostsA {-# OPAQUE cekMachineCostsVariantA #-} {-| The default cost model, including both builtin costs and machine step costs. @@ -91,56 +89,48 @@ cekCostModelVariantA :: CostModel CekMachineCosts BuiltinCostModel cekCostModelVariantA = CostModel cekMachineCostsVariantA builtinCostModelVariantA builtinCostModelVariantB :: BuiltinCostModel -builtinCostModelVariantB = - $$(readJSONFromFile DFP.builtinCostModelFileB) +builtinCostModelVariantB = builtinCostModelB {-# OPAQUE builtinCostModelVariantB #-} -- See Note [No inlining for CekMachineCosts] cekMachineCostsVariantB :: CekMachineCosts -cekMachineCostsVariantB = - $$(readJSONFromFile DFP.cekMachineCostsFileB) +cekMachineCostsVariantB = cekMachineCostsB {-# OPAQUE cekMachineCostsVariantB #-} cekCostModelVariantB :: CostModel CekMachineCosts BuiltinCostModel cekCostModelVariantB = CostModel cekMachineCostsVariantB builtinCostModelVariantB builtinCostModelVariantC :: BuiltinCostModel -builtinCostModelVariantC = - $$(readJSONFromFile DFP.builtinCostModelFileC) +builtinCostModelVariantC = builtinCostModelC {-# OPAQUE builtinCostModelVariantC #-} -- See Note [No inlining for CekMachineCosts] cekMachineCostsVariantC :: CekMachineCosts -cekMachineCostsVariantC = - $$(readJSONFromFile DFP.cekMachineCostsFileC) +cekMachineCostsVariantC = cekMachineCostsC {-# OPAQUE cekMachineCostsVariantC #-} cekCostModelVariantC :: CostModel CekMachineCosts BuiltinCostModel cekCostModelVariantC = CostModel cekMachineCostsVariantC builtinCostModelVariantC builtinCostModelVariantD :: BuiltinCostModel -builtinCostModelVariantD = - $$(readJSONFromFile DFP.builtinCostModelFileD) +builtinCostModelVariantD = builtinCostModelB -- D uses B's model {-# OPAQUE builtinCostModelVariantD #-} -- See Note [No inlining for CekMachineCosts] cekMachineCostsVariantD :: CekMachineCosts -cekMachineCostsVariantD = - $$(readJSONFromFile DFP.cekMachineCostsFileD) +cekMachineCostsVariantD = cekMachineCostsB -- D uses B's costs {-# OPAQUE cekMachineCostsVariantD #-} cekCostModelVariantD :: CostModel CekMachineCosts BuiltinCostModel cekCostModelVariantD = CostModel cekMachineCostsVariantD builtinCostModelVariantD builtinCostModelVariantE :: BuiltinCostModel -builtinCostModelVariantE = - $$(readJSONFromFile DFP.builtinCostModelFileE) +builtinCostModelVariantE = builtinCostModelC -- E uses C's model {-# OPAQUE builtinCostModelVariantE #-} -- See Note [No inlining for CekMachineCosts] cekMachineCostsVariantE :: CekMachineCosts -cekMachineCostsVariantE = - $$(readJSONFromFile DFP.cekMachineCostsFileE) +cekMachineCostsVariantE = cekMachineCostsC -- E uses C's costs {-# OPAQUE cekMachineCostsVariantE #-} cekCostModelVariantE :: CostModel CekMachineCosts BuiltinCostModel diff --git a/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/SimpleBuiltinCostModel.hs b/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/SimpleBuiltinCostModel.hs index b9323f8d9e6..b7934a8dc8f 100644 --- a/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/SimpleBuiltinCostModel.hs +++ b/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/SimpleBuiltinCostModel.hs @@ -3,9 +3,6 @@ -- TODO: Extend this to handle the different variants of the cost model -{-| A program to parse a JSON representation of costing functions for Plutus Core - builtins and and produce a simple cost model which can be used from Agda and other - executables -} module PlutusCore.Evaluation.Machine.SimpleBuiltinCostModel ( BuiltinCostMap , BuiltinCostKeyMap @@ -13,13 +10,17 @@ module PlutusCore.Evaluation.Machine.SimpleBuiltinCostModel , defaultSimpleBuiltinCostModel ) where +import Data.Aeson (Result (..), eitherDecodeFileStrict, fromJSON, toJSON) import Data.Aeson.Key as Key (toText) import Data.Aeson.KeyMap qualified as KeyMap import Data.Aeson.THReader (readJSONFromFile) import Data.Bifunctor import Data.Text (Text, replace) import PlutusCore.DataFilePaths qualified as DFP +import PlutusCore.Evaluation.Machine.BuiltinCostModel +import PlutusCore.Evaluation.Machine.CostModel.BuiltinCostModelC (builtinCostModelC) import PlutusCore.Evaluation.Machine.CostingFun.SimpleJSON +import System.IO.Unsafe type BuiltinCostMap = [(Text, CpuAndMemoryModel)] type BuiltinCostKeyMap = KeyMap.KeyMap CpuAndMemoryModel @@ -27,8 +28,7 @@ type BuiltinCostKeyMap = KeyMap.KeyMap CpuAndMemoryModel {-| The default builtin cost map. TODO: maybe we should take account of the semantic variant here. -} defaultBuiltinCostKeyMap :: BuiltinCostKeyMap -defaultBuiltinCostKeyMap = - $$(readJSONFromFile DFP.latestBuiltinCostModelFile) +defaultBuiltinCostKeyMap = builtinCostModelToBuiltinCostKeyMap builtinCostModelC -- replace underscores _ by dashes - builtinName :: Text -> Text @@ -39,3 +39,16 @@ toSimpleBuiltinCostModel m = map (first (builtinName . toText)) (KeyMap.toList m defaultSimpleBuiltinCostModel :: BuiltinCostMap defaultSimpleBuiltinCostModel = toSimpleBuiltinCostModel defaultBuiltinCostKeyMap + +-- We rely on +builtinCostModelToBuiltinCostKeyMap :: BuiltinCostModel -> BuiltinCostKeyMap +builtinCostModelToBuiltinCostKeyMap model = do + unsafePerformIO $ do + r <- eitherDecodeFileStrict "plutus-core/cost-model/data/builtinCostModelC.json" + case r of + Left str -> error ("Uexpected malformed json for builtin model: " <> str) + Right x -> return x + +-- case fromJSON (toJSON model) of +-- Error str -> error ("Uexpected malformed json for builtin model: " <> str) +-- Success x -> x