From 587554034b20c531bf3b3aa069560d02e9bb739a Mon Sep 17 00:00:00 2001 From: Michael Karg Date: Fri, 10 May 2024 09:12:32 +0200 Subject: [PATCH 01/21] wb | tracing: minimal verbosity for peer selection counter --- nix/workbench/service/tracing.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix/workbench/service/tracing.nix b/nix/workbench/service/tracing.nix index e2ff2b14b0d..0965d160fb0 100644 --- a/nix/workbench/service/tracing.nix +++ b/nix/workbench/service/tracing.nix @@ -62,6 +62,7 @@ let "Net.Mux.Local".severity = "Notice"; "Net.Mux.Remote".severity = "Notice"; "Net.PeerSelection.Actions".severity = "Debug"; + "Net.PeerSelection.Counters".detail = "DMinimal"; "Net.PeerSelection.Counters".severity = "Debug"; "Net.PeerSelection.Initiator".severity = "Notice"; "Net.PeerSelection.Responder".severity = "Notice"; From 48edca97b8bef8a624a7e5f0e78aeb67ef804f1e Mon Sep 17 00:00:00 2001 From: Michael Karg Date: Fri, 10 May 2024 10:50:11 +0200 Subject: [PATCH 02/21] wb | profiles: new DRep injection profiles --- Makefile | 7 +-- .../analyse/chain-filters/fromslot-20k.json | 7 +++ nix/workbench/profile/prof1-variants.jq | 47 ++++++++++++++++--- 3 files changed, 52 insertions(+), 9 deletions(-) create mode 100644 nix/workbench/analyse/chain-filters/fromslot-20k.json diff --git a/Makefile b/Makefile index 7c235f057c9..9ec272dbde2 100644 --- a/Makefile +++ b/Makefile @@ -77,8 +77,7 @@ ps: ## Plain-text list of profiles PROFILES_BASE := default default-p2p plutus plutus-secp-ecdsa plutus-secp-schnorr oldtracing idle tracer-only PROFILES_FAST := fast fast-p2p fast-plutus fast-notracer fast-oldtracing faststartup-24M PROFILES_CI_TEST := ci-test ci-test-p2p ci-test-plutus ci-test-notracer ci-test-rtview ci-test-dense10 -PROFILES_CI_BENCH := ci-bench ci-bench-p2p ci-bench-plutus ci-bench-plutus-secp-ecdsa ci-bench-plutus-secp-schnorr ci-bench-notracer ci-bench-rtview ci-bench-lmdb -PROFILES_CI_BENCH_DREP := ci-bench-drep +PROFILES_CI_BENCH := ci-bench ci-bench-p2p ci-bench-plutus ci-bench-plutus-secp-ecdsa ci-bench-plutus-secp-schnorr ci-bench-notracer ci-bench-rtview ci-bench-lmdb ci-bench-drep PROFILES_TRACE_BENCH := trace-bench trace-bench-notracer trace-bench-oldtracing trace-bench-rtview PROFILES_TRACE_FULL := trace-full trace-full-rtview PROFILES_EPOCHTRANS := epoch-transition @@ -99,6 +98,8 @@ PROFILES_VENDOR := dish dish-plutus dish-10M dish-10M-plutus # Not all local profiles are compatible or tested (yet) with a cloud runs PROFILES_NOMAD_PERF := default-nomadperf ci-test-nomadperf ci-bench-nomadperf value-nomadperf oldtracing-nomadperf ci-test-oldtracing-nomadperf ci-bench-oldtracing-nomadperf value-oldtracing-nomadperf PROFILES_NOMAD_PERF += plutus-nomadperf fast-nomadperf latency-nomadperf +PROFILES_NOMAD_PERF_DREP := value-drep1k-nomadperf value-drep2k-nomadperf value-drep10k-nomadperf +PROFILES_NOMAD_PERF_DREP += plutus-drep1k-nomadperf plutus-drep2k-nomadperf plutus-drep10k-nomadperf PROFILES_NOMAD_PERF_NOP2P := default-nomadperf-nop2p oldtracing-nomadperf-nop2p ci-test-nomadperf-nop2p ci-bench-nomadperf-nop2p PROFILES_NOMAD_PERF_NOP2P += value-nomadperf-nop2p value-oldtracing-nomadperf-nop2p plutus-nomadperf-nop2p fast-nomadperf-nop2p PROFILES_NOMAD_PERFSSD := value-nomadperfssd fast-nomadperfssd latency-nomadperfssd @@ -109,7 +110,6 @@ LOCAL_PROFILES += $(PROFILES_BASE) LOCAL_PROFILES += $(PROFILES_FAST) LOCAL_PROFILES += $(PROFILES_CI_TEST) LOCAL_PROFILES += $(PROFILES_CI_BENCH) -LOCAL_PROFILES += $(PROFILES_CI_BENCH_DREP) LOCAL_PROFILES += $(PROFILES_TRACE_BENCH) LOCAL_PROFILES += $(PROFILES_TRACE_FULL) LOCAL_PROFILES += $(PROFILES_EPOCHTRANS) @@ -122,6 +122,7 @@ LOCAL_PROFILES += $(PROFILES_FORGE_STRESS_RTS) LOCAL_PROFILES += $(PROFILES_CHAINSYNC) LOCAL_PROFILES += $(PROFILES_VENDOR) CLOUD_PROFILES += $(PROFILES_NOMAD_PERF) +CLOUD_PROFILES += $(PROFILES_NOMAD_PERF_DREP) CLOUD_PROFILES += $(PROFILES_NOMAD_PERF_NOP2P) CLOUD_PROFILES += $(PROFILES_NOMAD_PERFSSD) CLOUD_PROFILES += $(PROFILES_UTXOSCALE_SOLO) diff --git a/nix/workbench/analyse/chain-filters/fromslot-20k.json b/nix/workbench/analyse/chain-filters/fromslot-20k.json new file mode 100644 index 00000000000..fe8f8926ded --- /dev/null +++ b/nix/workbench/analyse/chain-filters/fromslot-20k.json @@ -0,0 +1,7 @@ +[ { "tag": "CSlot" + , "contents": + { "tag": "SlotGEq" + , "contents": 20000 + } + } +] diff --git a/nix/workbench/profile/prof1-variants.jq b/nix/workbench/profile/prof1-variants.jq index c65f58b4b5d..b980af1de18 100644 --- a/nix/workbench/profile/prof1-variants.jq +++ b/nix/workbench/profile/prof1-variants.jq @@ -91,13 +91,17 @@ def all_profile_variants: | { genesis: { dreps: 10 } + } as $dreps_tiny + | { genesis: + { dreps: 1000 + } } as $dreps_small | { genesis: - { dreps: 100 + { dreps: 2000 } } as $dreps_medium | { genesis: - { dreps: 1000 + { dreps: 10000 } } as $dreps_large ## @@ -623,7 +627,7 @@ def all_profile_variants: { desc: "Miniature dataset, CI-friendly duration, test scale" }) as $citest_base | - ($scenario_fixed_loaded * $doublet * $dataset_miniature * $for_15blk * $no_filtering * $dreps_small * + ($scenario_fixed_loaded * $doublet * $dataset_miniature * $for_15blk * $no_filtering * { desc: "Miniature dataset, CI-friendly duration, bench scale" }) as $cibench_base | @@ -810,6 +814,14 @@ def all_profile_variants: ($nomad_perfssd_solo_base * $nomad_perfssd_unicircle * $costmodel_v8_preview * $p2p ) as $utxoscale_solo_template | + # P&T Nomad cluster: 52 nodes, P2P by default - value-only workload + ($nomad_perf_base * $nomad_perf_dense * $p2p * $costmodel_v8_preview + ) as $value_nomadperf_template + | + # P&T Nomad cluster: 52 nodes, P2P by default - Plutus workload + ($nomad_perf_plutus_base * $nomad_perf_dense * $p2p * $costmodel_v8_preview + ) as $plutus_nomadperf_template + | ### First, auto-named profiles: ### @@ -956,6 +968,9 @@ def all_profile_variants: , $cibench_base * $with_rtview * { name: "ci-bench-rtview" } + , $cibench_base * $dreps_tiny * + { name: "ci-bench-drep" + } , $cibench_base * $p2p * { name: "ci-bench-lmdb" , node: { utxo_lmdb: true } @@ -1036,16 +1051,16 @@ def all_profile_variants: } ## P&T Nomad cluster: 52 nodes, 3 regions, value-only (incl. old tracing variant) and Plutus, P2P enabled by default - , $nomad_perf_base * $nomad_perf_dense * $p2p * $costmodel_v8_preview * + , $value_nomadperf_template * { name: "value-nomadperf" } , $nomad_perfssd_base * $nomad_perfssd_dense * $p2p * $costmodel_v8_preview * { name: "value-nomadperfssd" } - , $nomad_perf_base * $nomad_perf_dense * $p2p * $costmodel_v8_preview * $old_tracing * + , $value_nomadperf_template * $old_tracing * { name: "value-oldtracing-nomadperf" } - , $nomad_perf_plutus_base * $nomad_perf_dense * $p2p * $costmodel_v8_preview * + , $plutus_nomadperf_template * { name: "plutus-nomadperf" } , $nomad_perf_latency_base * $nomad_perf_dense * $p2p * $costmodel_v8_preview * @@ -1055,6 +1070,26 @@ def all_profile_variants: { name: "latency-nomadperfssd" } +## P&T Nomad cluster: 52 nodes, value-only and Plutus workloads - DRep injection variants + , $value_nomadperf_template * $dreps_small * + { name: "value-drep1k-nomadperf" + } + , $value_nomadperf_template * $dreps_medium * + { name: "value-drep2k-nomadperf" + } + , $value_nomadperf_template * $dreps_large * + { name: "value-drep10k-nomadperf" + } + , $plutus_nomadperf_template * $dreps_small * + { name: "plutus-drep1k-nomadperf" + } + , $plutus_nomadperf_template * $dreps_medium * + { name: "plutus-drep2k-nomadperf" + } + , $plutus_nomadperf_template * $dreps_large * + { name: "plutus-drep10k-nomadperf" + } + ## P&T Nomad cluster: 52 nodes, 3 regions, value-only (with old tracing variant) and Plutus, no P2P flavour , $nomad_perf_base * $nomad_perf_dense * $costmodel_v8_preview * { name: "value-nomadperf-nop2p" From 4dbe628fe8115d14aac00d6393e42fc14e1880bd Mon Sep 17 00:00:00 2001 From: Michael Karg Date: Tue, 14 May 2024 14:58:24 +0200 Subject: [PATCH 03/21] new PlutusV3 benchmark script; update cost model; testbed improvements --- bench/plutus-scripts-bench/app/gen-plutus.hs | 60 ++- .../plutus-scripts-bench.cabal | 17 +- .../src/Cardano/Benchmarking/PlutusScripts.hs | 2 + .../PlutusScripts/HashOntoG2AndAdd.hs | 62 +++ .../data/EcdsaSecp256k1Loop.redeemer.json | 17 + .../data/HashOntoG2AndAdd.redeemer.json | 24 + bench/tx-generator/data/Loop.redeemer.json | 3 + bench/tx-generator/data/LoopV3.redeemer.json | 3 + .../data/SchnorrSecp256k1Loop.redeemer.json | 17 + .../data/ecdsa-secp256k1-loop.redeemer.json | 1 - bench/tx-generator/data/loop.redeemer.json | 1 - .../data/protocol-parameters-conway.json | 461 +++++++++--------- .../data/schnorr-secp256k1-loop.redeemer.json | 1 - bench/tx-generator/test/ApiTest.hs | 186 ++++--- bench/tx-generator/tx-generator.cabal | 2 + 15 files changed, 542 insertions(+), 315 deletions(-) create mode 100644 bench/plutus-scripts-bench/src/Cardano/Benchmarking/PlutusScripts/HashOntoG2AndAdd.hs create mode 100644 bench/tx-generator/data/EcdsaSecp256k1Loop.redeemer.json create mode 100644 bench/tx-generator/data/HashOntoG2AndAdd.redeemer.json create mode 100644 bench/tx-generator/data/Loop.redeemer.json create mode 100644 bench/tx-generator/data/LoopV3.redeemer.json create mode 100644 bench/tx-generator/data/SchnorrSecp256k1Loop.redeemer.json delete mode 100644 bench/tx-generator/data/ecdsa-secp256k1-loop.redeemer.json delete mode 100644 bench/tx-generator/data/loop.redeemer.json delete mode 100644 bench/tx-generator/data/schnorr-secp256k1-loop.redeemer.json diff --git a/bench/plutus-scripts-bench/app/gen-plutus.hs b/bench/plutus-scripts-bench/app/gen-plutus.hs index b4e6a8b2f4c..010d501b2f3 100644 --- a/bench/plutus-scripts-bench/app/gen-plutus.hs +++ b/bench/plutus-scripts-bench/app/gen-plutus.hs @@ -1,36 +1,46 @@ +{-# LANGUAGE LambdaCase #-} {-# LANGUAGE RecordWildCards #-} -import Cardano.Benchmarking.PlutusScripts (findPlutusScript, encodePlutusScript) +import Cardano.Benchmarking.PlutusScripts + import qualified Data.ByteString.Lazy as LBS (hPut) -import Options.Applicative -import System.Exit (die) -import System.IO (IOMode(..), openFile, stdout) +import Data.List (sort) +import Options.Applicative +import System.Exit (die) +import System.IO (IOMode (..), openFile, stdout) -data Options = Options - { optOut :: Maybe FilePath - , optMod :: String - } deriving (Eq, Read, Show) +data Options = + List + | Print + { optOut :: Maybe FilePath + , optMod :: String + } deriving (Eq, Show) opts :: Parser Options -opts = Options - <$> - optional (strOption - ( long "output" - <> short 'o' - <> metavar "FILE" - <> help "Write output to FILE" - ) - ) - <*> - strArgument - ( metavar "SCRIPT" - <> help "Write SCRIPT to output" - ) +opts = + subparser $ listParser <> printParser + where + listParser = command "list" $ info (p <**> helper) $ progDesc "list available scripts" + where p = pure List + + printParser = command "print" $ info (p <**> helper) $ progDesc "serialize script" + where + p = Print + <$> optional (strOption + ( long "output" + <> short 'o' + <> metavar "FILE" + <> help "Write output to FILE" + )) + <*> strArgument (metavar "SCRIPT" <> help "Write SCRIPT to output") + +pref :: ParserPrefs +pref = prefs showHelpOnEmpty main :: IO () -main = - do - Options {..} <- execParser (info opts fullDesc) +main = customExecParser pref (info opts fullDesc) >>= \case + List -> mapM_ putStrLn (sort listPlutusScripts) + Print{..} -> do s <- case findPlutusScript optMod of Just s -> pure s Nothing -> die $ "unable to find plutus script for `" ++ optMod ++ "'" diff --git a/bench/plutus-scripts-bench/plutus-scripts-bench.cabal b/bench/plutus-scripts-bench/plutus-scripts-bench.cabal index aeeb80e0c1b..43778b286e9 100644 --- a/bench/plutus-scripts-bench/plutus-scripts-bench.cabal +++ b/bench/plutus-scripts-bench/plutus-scripts-bench.cabal @@ -1,6 +1,6 @@ cabal-version: 3.0 name: plutus-scripts-bench -version: 1.0.2.1 +version: 1.0.3.0 synopsis: Plutus scripts used for benchmarking description: Plutus scripts used for benchmarking. category: Cardano, @@ -40,12 +40,18 @@ common common-definitions ImportQualifiedPost OverloadedStrings - -- See Plutus Tx readme for why we need the following flags: - -- -fobject-code -fno-ignore-interface-pragmas and -fno-omit-interface-pragmas ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wpartial-fields -Wredundant-constraints - -fobject-code -fno-ignore-interface-pragmas -fno-omit-interface-pragmas + -Widentities -Wnoncanonical-monad-instances + + -- See Plutus Tx readme for why we need the following flags: + ghc-options: + -fno-specialise -fno-spec-constr -fno-strictness + -fno-ignore-interface-pragmas -fno-omit-interface-pragmas + -fno-unbox-strict-fields -fno-unbox-small-strict-fields + -fobject-code + -- TODO: what about? -fno-full-laziness if flag(defer-plugin-errors) ghc-options: -fplugin-opt PlutusTx.Plugin:defer-errors @@ -66,6 +72,7 @@ library other-modules: Cardano.Benchmarking.PlutusScripts.CustomCall Cardano.Benchmarking.PlutusScripts.EcdsaSecp256k1Loop + Cardano.Benchmarking.PlutusScripts.HashOntoG2AndAdd Cardano.Benchmarking.PlutusScripts.Loop Cardano.Benchmarking.PlutusScripts.LoopV3 Cardano.Benchmarking.PlutusScripts.SchnorrSecp256k1Loop @@ -85,7 +92,7 @@ library build-depends: , filepath , bytestring - , serialise + -- , serialise , template-haskell , text diff --git a/bench/plutus-scripts-bench/src/Cardano/Benchmarking/PlutusScripts.hs b/bench/plutus-scripts-bench/src/Cardano/Benchmarking/PlutusScripts.hs index bf06198c636..28ce667426a 100644 --- a/bench/plutus-scripts-bench/src/Cardano/Benchmarking/PlutusScripts.hs +++ b/bench/plutus-scripts-bench/src/Cardano/Benchmarking/PlutusScripts.hs @@ -25,6 +25,7 @@ import Cardano.Api import qualified Cardano.Benchmarking.PlutusScripts.CustomCall as CustomCall import qualified Cardano.Benchmarking.PlutusScripts.EcdsaSecp256k1Loop as ECDSA +import qualified Cardano.Benchmarking.PlutusScripts.HashOntoG2AndAdd as HashG2Add import qualified Cardano.Benchmarking.PlutusScripts.Loop as Loop import qualified Cardano.Benchmarking.PlutusScripts.LoopV3 as LoopV3 import qualified Cardano.Benchmarking.PlutusScripts.SchnorrSecp256k1Loop as Schnorr @@ -35,6 +36,7 @@ getAllScripts :: [PlutusBenchScript] getAllScripts = [ CustomCall.script , ECDSA.script + , HashG2Add.script , Loop.script , LoopV3.script , Schnorr.script diff --git a/bench/plutus-scripts-bench/src/Cardano/Benchmarking/PlutusScripts/HashOntoG2AndAdd.hs b/bench/plutus-scripts-bench/src/Cardano/Benchmarking/PlutusScripts/HashOntoG2AndAdd.hs new file mode 100644 index 00000000000..787e7e769f0 --- /dev/null +++ b/bench/plutus-scripts-bench/src/Cardano/Benchmarking/PlutusScripts/HashOntoG2AndAdd.hs @@ -0,0 +1,62 @@ +{-# LANGUAGE BangPatterns #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE NoImplicitPrelude #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeFamilies #-} + +-- | This validator script is based on the Plutus benchmark +-- 'Hash n bytestrings onto G2 and add points' +-- cf. https://github.com/IntersectMBO/plutus/blob/master/plutus-benchmark/bls12-381-costs/test/9.6/bls12-381-costs.golden + +module Cardano.Benchmarking.PlutusScripts.HashOntoG2AndAdd (script) where + +import Cardano.Api.Shelley (PlutusScript (..), PlutusScriptV3, PlutusScriptVersion (..), + Script (..), toScriptInAnyLang) + +import Cardano.Benchmarking.ScriptAPI +import qualified PlutusLedgerApi.V3 as PlutusV3 + +import Prelude as Haskell (String, (.), (<$>)) + +-- import Data.ByteString (ByteString) +import qualified Data.ByteString.Short as SBS + +import Language.Haskell.TH +import Language.Haskell.TH.Syntax +import qualified PlutusTx +import PlutusTx.Prelude as Tx hiding (Semigroup (..), (.), (<$>)) + + +scriptName :: Haskell.String +scriptName + = prepareScriptName $(LitE . StringL . loc_module <$> qLocation) + +script :: PlutusBenchScript +script = mkPlutusBenchScript scriptName (toScriptInAnyLang (PlutusScript PlutusScriptV3 scriptSerialized)) + + +{-# INLINABLE mkValidator #-} +mkValidator :: BuiltinData -> BuiltinData -> BuiltinData -> () +mkValidator _datum red _txContext = + case PlutusV3.fromBuiltinData red of + Nothing -> Tx.traceError "invalid redeemer" + Just (n, l) -> + if n < (1000000 :: Integer) -- large number ensures same bitsize for all counter values + then traceError "redeemer is < 1000000" + else loop n l + where + hashAndAddG2 :: [BuiltinByteString] -> BuiltinBLS12_381_G2_Element + hashAndAddG2 l = + go l (Tx.bls12_381_G2_uncompress Tx.bls12_381_G2_compressed_zero) + where go [] !acc = acc + go (q:qs) !acc = go qs $ Tx.bls12_381_G2_add (Tx.bls12_381_G2_hashToGroup q emptyByteString) acc + loop i l + | i == 1000000 = () + | otherwise = let !_ = hashAndAddG2 l in loop (pred i) l + +hashAndAddG2ShortBs :: SBS.ShortByteString +hashAndAddG2ShortBs = PlutusV3.serialiseCompiledCode $$(PlutusTx.compile [|| mkValidator ||]) + +scriptSerialized :: PlutusScript PlutusScriptV3 +scriptSerialized = PlutusScriptSerialised hashAndAddG2ShortBs diff --git a/bench/tx-generator/data/EcdsaSecp256k1Loop.redeemer.json b/bench/tx-generator/data/EcdsaSecp256k1Loop.redeemer.json new file mode 100644 index 00000000000..d2f51541a36 --- /dev/null +++ b/bench/tx-generator/data/EcdsaSecp256k1Loop.redeemer.json @@ -0,0 +1,17 @@ +{ + "constructor": 0, + "fields": [ + { + "int": 1000000 + }, + { + "bytes": "0392d7b94bc6a11c335a043ee1ff326b6eacee6230d3685861cd62bce350a172e0" + }, + { + "bytes": "16e0bf1f85594a11e75030981c0b670370b3ad83a43f49ae58a2fd6f6513cde9" + }, + { + "bytes": "5fb12954b28be6456feb080cfb8467b6f5677f62eb9ad231de7a575f4b6857512754fb5ef7e0e60e270832e7bb0e2f0dc271012fa9c46c02504aa0e798be6295" + } + ] +} diff --git a/bench/tx-generator/data/HashOntoG2AndAdd.redeemer.json b/bench/tx-generator/data/HashOntoG2AndAdd.redeemer.json new file mode 100644 index 00000000000..9228c2b8cbd --- /dev/null +++ b/bench/tx-generator/data/HashOntoG2AndAdd.redeemer.json @@ -0,0 +1,24 @@ +{ + "constructor": 0, + "fields": [ + { + "int": 1000000 + }, + { + "list": [ + { + "bytes": "714805c6" + }, + { + "bytes": "c413111e" + }, + { + "bytes": "2d7eb870" + }, + { + "bytes": "4ecbd6a1" + } + ] + } + ] +} diff --git a/bench/tx-generator/data/Loop.redeemer.json b/bench/tx-generator/data/Loop.redeemer.json new file mode 100644 index 00000000000..55007f026cd --- /dev/null +++ b/bench/tx-generator/data/Loop.redeemer.json @@ -0,0 +1,3 @@ +{ + "int": 1000000 +} diff --git a/bench/tx-generator/data/LoopV3.redeemer.json b/bench/tx-generator/data/LoopV3.redeemer.json new file mode 100644 index 00000000000..55007f026cd --- /dev/null +++ b/bench/tx-generator/data/LoopV3.redeemer.json @@ -0,0 +1,3 @@ +{ + "int": 1000000 +} diff --git a/bench/tx-generator/data/SchnorrSecp256k1Loop.redeemer.json b/bench/tx-generator/data/SchnorrSecp256k1Loop.redeemer.json new file mode 100644 index 00000000000..3be29c399eb --- /dev/null +++ b/bench/tx-generator/data/SchnorrSecp256k1Loop.redeemer.json @@ -0,0 +1,17 @@ +{ + "constructor": 0, + "fields": [ + { + "int": 1000000 + }, + { + "bytes": "599de3e582e2a3779208a210dfeae8f330b9af00a47a7fb22e9bb8ef596f301b" + }, + { + "bytes": "30303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030" + }, + { + "bytes": "5a56da88e6fd8419181dec4d3dd6997bab953d2fc71ab65e23cfc9e7e3d1a310613454a60f6703819a39fdac2a410a094442afd1fc083354443e8d8bb4461a9b" + } + ] +} diff --git a/bench/tx-generator/data/ecdsa-secp256k1-loop.redeemer.json b/bench/tx-generator/data/ecdsa-secp256k1-loop.redeemer.json deleted file mode 100644 index 73bced12381..00000000000 --- a/bench/tx-generator/data/ecdsa-secp256k1-loop.redeemer.json +++ /dev/null @@ -1 +0,0 @@ -{"constructor":0,"fields":[{"int":1000000},{"bytes":"0392d7b94bc6a11c335a043ee1ff326b6eacee6230d3685861cd62bce350a172e0"},{"bytes":"16e0bf1f85594a11e75030981c0b670370b3ad83a43f49ae58a2fd6f6513cde9"},{"bytes":"5fb12954b28be6456feb080cfb8467b6f5677f62eb9ad231de7a575f4b6857512754fb5ef7e0e60e270832e7bb0e2f0dc271012fa9c46c02504aa0e798be6295"}]} \ No newline at end of file diff --git a/bench/tx-generator/data/loop.redeemer.json b/bench/tx-generator/data/loop.redeemer.json deleted file mode 100644 index 21df20cd649..00000000000 --- a/bench/tx-generator/data/loop.redeemer.json +++ /dev/null @@ -1 +0,0 @@ -{"int":1000000} \ No newline at end of file diff --git a/bench/tx-generator/data/protocol-parameters-conway.json b/bench/tx-generator/data/protocol-parameters-conway.json index e7c1f6633ae..e35b09ea46f 100644 --- a/bench/tx-generator/data/protocol-parameters-conway.json +++ b/bench/tx-generator/data/protocol-parameters-conway.json @@ -346,232 +346,241 @@ 32947, 10 ], - "PlutusV3": - { - "addInteger-cpu-arguments-intercept": 205665, - "addInteger-cpu-arguments-slope": 812, - "addInteger-memory-arguments-intercept": 1, - "addInteger-memory-arguments-slope": 1, - "appendByteString-cpu-arguments-intercept": 1000, - "appendByteString-cpu-arguments-slope": 571, - "appendByteString-memory-arguments-intercept": 0, - "appendByteString-memory-arguments-slope": 1, - "appendString-cpu-arguments-intercept": 1000, - "appendString-cpu-arguments-slope": 24177, - "appendString-memory-arguments-intercept": 4, - "appendString-memory-arguments-slope": 1, - "bData-cpu-arguments": 1000, - "bData-memory-arguments": 32, - "blake2b_224-cpu-arguments-intercept": 117366, - "blake2b_224-cpu-arguments-slope": 10475, - "blake2b_224-memory-arguments": 4, - "blake2b_256-cpu-arguments-intercept": 117366, - "blake2b_256-cpu-arguments-slope": 10475, - "blake2b_256-memory-arguments": 4, - "bls12_381_G1_add-cpu-arguments": 1046420, - "bls12_381_G1_add-memory-arguments": 18, - "bls12_381_G1_compress-cpu-arguments": 3387741, - "bls12_381_G1_compress-memory-arguments": 6, - "bls12_381_G1_equal-cpu-arguments": 545063, - "bls12_381_G1_equal-memory-arguments": 1, - "bls12_381_G1_hashToGroup-cpu-arguments-intercept": 66311195, - "bls12_381_G1_hashToGroup-cpu-arguments-slope": 23097, - "bls12_381_G1_hashToGroup-memory-arguments": 18, - "bls12_381_G1_neg-cpu-arguments": 292890, - "bls12_381_G1_neg-memory-arguments": 18, - "bls12_381_G1_scalarMul-cpu-arguments-intercept": 94607019, - "bls12_381_G1_scalarMul-cpu-arguments-slope": 87060, - "bls12_381_G1_scalarMul-memory-arguments": 18, - "bls12_381_G1_uncompress-cpu-arguments": 16598737, - "bls12_381_G1_uncompress-memory-arguments": 18, - "bls12_381_G2_add-cpu-arguments": 2359410, - "bls12_381_G2_add-memory-arguments": 36, - "bls12_381_G2_compress-cpu-arguments": 3973992, - "bls12_381_G2_compress-memory-arguments": 12, - "bls12_381_G2_equal-cpu-arguments": 1102635, - "bls12_381_G2_equal-memory-arguments": 1, - "bls12_381_G2_hashToGroup-cpu-arguments-intercept": 204557793, - "bls12_381_G2_hashToGroup-cpu-arguments-slope": 23271, - "bls12_381_G2_hashToGroup-memory-arguments": 36, - "bls12_381_G2_neg-cpu-arguments": 307813, - "bls12_381_G2_neg-memory-arguments": 36, - "bls12_381_G2_scalarMul-cpu-arguments-intercept": 190191402, - "bls12_381_G2_scalarMul-cpu-arguments-slope": 85902, - "bls12_381_G2_scalarMul-memory-arguments": 36, - "bls12_381_G2_uncompress-cpu-arguments": 33191512, - "bls12_381_G2_uncompress-memory-arguments": 36, - "bls12_381_finalVerify-cpu-arguments": 388656972, - "bls12_381_finalVerify-memory-arguments": 1, - "bls12_381_millerLoop-cpu-arguments": 402099373, - "bls12_381_millerLoop-memory-arguments": 72, - "bls12_381_mulMlResult-cpu-arguments": 2544991, - "bls12_381_mulMlResult-memory-arguments": 72, - "cekApplyCost-exBudgetCPU": 23000, - "cekApplyCost-exBudgetMemory": 100, - "cekBuiltinCost-exBudgetCPU": 23000, - "cekBuiltinCost-exBudgetMemory": 100, - "cekCaseCost-exBudgetCPU": 23000, - "cekCaseCost-exBudgetMemory": 100, - "cekConstCost-exBudgetCPU": 23000, - "cekConstCost-exBudgetMemory": 100, - "cekConstrCost-exBudgetCPU": 23000, - "cekConstrCost-exBudgetMemory": 100, - "cekDelayCost-exBudgetCPU": 23000, - "cekDelayCost-exBudgetMemory": 100, - "cekForceCost-exBudgetCPU": 23000, - "cekForceCost-exBudgetMemory": 100, - "cekLamCost-exBudgetCPU": 23000, - "cekLamCost-exBudgetMemory": 100, - "cekStartupCost-exBudgetCPU": 100, - "cekStartupCost-exBudgetMemory": 100, - "cekVarCost-exBudgetCPU": 23000, - "cekVarCost-exBudgetMemory": 100, - "chooseData-cpu-arguments": 19537, - "chooseData-memory-arguments": 32, - "chooseList-cpu-arguments": 175354, - "chooseList-memory-arguments": 32, - "chooseUnit-cpu-arguments": 46417, - "chooseUnit-memory-arguments": 4, - "consByteString-cpu-arguments-intercept": 221973, - "consByteString-cpu-arguments-slope": 511, - "consByteString-memory-arguments-intercept": 0, - "consByteString-memory-arguments-slope": 1, - "constrData-cpu-arguments": 89141, - "constrData-memory-arguments": 32, - "decodeUtf8-cpu-arguments-intercept": 497525, - "decodeUtf8-cpu-arguments-slope": 14068, - "decodeUtf8-memory-arguments-intercept": 4, - "decodeUtf8-memory-arguments-slope": 2, - "divideInteger-cpu-arguments-constant": 196500, - "divideInteger-cpu-arguments-model-arguments-intercept": 453240, - "divideInteger-cpu-arguments-model-arguments-slope": 220, - "divideInteger-memory-arguments-intercept": 0, - "divideInteger-memory-arguments-minimum": 1, - "divideInteger-memory-arguments-slope": 1, - "encodeUtf8-cpu-arguments-intercept": 1000, - "encodeUtf8-cpu-arguments-slope": 28662, - "encodeUtf8-memory-arguments-intercept": 4, - "encodeUtf8-memory-arguments-slope": 2, - "equalsByteString-cpu-arguments-constant": 245000, - "equalsByteString-cpu-arguments-intercept": 216773, - "equalsByteString-cpu-arguments-slope": 62, - "equalsByteString-memory-arguments": 1, - "equalsData-cpu-arguments-intercept": 1060367, - "equalsData-cpu-arguments-slope": 12586, - "equalsData-memory-arguments": 1, - "equalsInteger-cpu-arguments-intercept": 208512, - "equalsInteger-cpu-arguments-slope": 421, - "equalsInteger-memory-arguments": 1, - "equalsString-cpu-arguments-constant": 187000, - "equalsString-cpu-arguments-intercept": 1000, - "equalsString-cpu-arguments-slope": 52998, - "equalsString-memory-arguments": 1, - "fstPair-cpu-arguments": 80436, - "fstPair-memory-arguments": 32, - "headList-cpu-arguments": 43249, - "headList-memory-arguments": 32, - "iData-cpu-arguments": 1000, - "iData-memory-arguments": 32, - "ifThenElse-cpu-arguments": 80556, - "ifThenElse-memory-arguments": 1, - "indexByteString-cpu-arguments": 57667, - "indexByteString-memory-arguments": 4, - "keccak_256-cpu-arguments-intercept": 1927926, - "keccak_256-cpu-arguments-slope": 82523, - "keccak_256-memory-arguments": 4, - "lengthOfByteString-cpu-arguments": 1000, - "lengthOfByteString-memory-arguments": 10, - "lessThanByteString-cpu-arguments-intercept": 197145, - "lessThanByteString-cpu-arguments-slope": 156, - "lessThanByteString-memory-arguments": 1, - "lessThanEqualsByteString-cpu-arguments-intercept": 197145, - "lessThanEqualsByteString-cpu-arguments-slope": 156, - "lessThanEqualsByteString-memory-arguments": 1, - "lessThanEqualsInteger-cpu-arguments-intercept": 204924, - "lessThanEqualsInteger-cpu-arguments-slope": 473, - "lessThanEqualsInteger-memory-arguments": 1, - "lessThanInteger-cpu-arguments-intercept": 208896, - "lessThanInteger-cpu-arguments-slope": 511, - "lessThanInteger-memory-arguments": 1, - "listData-cpu-arguments": 52467, - "listData-memory-arguments": 32, - "mapData-cpu-arguments": 64832, - "mapData-memory-arguments": 32, - "mkCons-cpu-arguments": 65493, - "mkCons-memory-arguments": 32, - "mkNilData-cpu-arguments": 22558, - "mkNilData-memory-arguments": 32, - "mkNilPairData-cpu-arguments": 16563, - "mkNilPairData-memory-arguments": 32, - "mkPairData-cpu-arguments": 76511, - "mkPairData-memory-arguments": 32, - "modInteger-cpu-arguments-constant": 196500, - "modInteger-cpu-arguments-model-arguments-intercept": 453240, - "modInteger-cpu-arguments-model-arguments-slope": 220, - "modInteger-memory-arguments-intercept": 0, - "modInteger-memory-arguments-minimum": 1, - "modInteger-memory-arguments-slope": 1, - "multiplyInteger-cpu-arguments-intercept": 69522, - "multiplyInteger-cpu-arguments-slope": 11687, - "multiplyInteger-memory-arguments-intercept": 0, - "multiplyInteger-memory-arguments-slope": 1, - "nullList-cpu-arguments": 60091, - "nullList-memory-arguments": 32, - "quotientInteger-cpu-arguments-constant": 196500, - "quotientInteger-cpu-arguments-model-arguments-intercept": 453240, - "quotientInteger-cpu-arguments-model-arguments-slope": 220, - "quotientInteger-memory-arguments-intercept": 0, - "quotientInteger-memory-arguments-minimum": 1, - "quotientInteger-memory-arguments-slope": 1, - "remainderInteger-cpu-arguments-constant": 196500, - "remainderInteger-cpu-arguments-model-arguments-intercept": 453240, - "remainderInteger-cpu-arguments-model-arguments-slope": 220, - "remainderInteger-memory-arguments-intercept": 0, - "remainderInteger-memory-arguments-minimum": 1, - "remainderInteger-memory-arguments-slope": 1, - "serialiseData-cpu-arguments-intercept": 1159724, - "serialiseData-cpu-arguments-slope": 392670, - "serialiseData-memory-arguments-intercept": 0, - "serialiseData-memory-arguments-slope": 2, - "sha2_256-cpu-arguments-intercept": 806990, - "sha2_256-cpu-arguments-slope": 30482, - "sha2_256-memory-arguments": 4, - "sha3_256-cpu-arguments-intercept": 1927926, - "sha3_256-cpu-arguments-slope": 82523, - "sha3_256-memory-arguments": 4, - "sliceByteString-cpu-arguments-intercept": 265318, - "sliceByteString-cpu-arguments-slope": 0, - "sliceByteString-memory-arguments-intercept": 4, - "sliceByteString-memory-arguments-slope": 0, - "sndPair-cpu-arguments": 85931, - "sndPair-memory-arguments": 32, - "subtractInteger-cpu-arguments-intercept": 205665, - "subtractInteger-cpu-arguments-slope": 812, - "subtractInteger-memory-arguments-intercept": 1, - "subtractInteger-memory-arguments-slope": 1, - "tailList-cpu-arguments": 41182, - "tailList-memory-arguments": 32, - "trace-cpu-arguments": 212342, - "trace-memory-arguments": 32, - "unBData-cpu-arguments": 31220, - "unBData-memory-arguments": 32, - "unConstrData-cpu-arguments": 32696, - "unConstrData-memory-arguments": 32, - "unIData-cpu-arguments": 43357, - "unIData-memory-arguments": 32, - "unListData-cpu-arguments": 32247, - "unListData-memory-arguments": 32, - "unMapData-cpu-arguments": 38314, - "unMapData-memory-arguments": 32, - "verifyEcdsaSecp256k1Signature-cpu-arguments": 35190005, - "verifyEcdsaSecp256k1Signature-memory-arguments": 10, - "verifyEd25519Signature-cpu-arguments-intercept": 57996947, - "verifyEd25519Signature-cpu-arguments-slope": 18975, - "verifyEd25519Signature-memory-arguments": 10, - "verifySchnorrSecp256k1Signature-cpu-arguments-intercept": 39121781, - "verifySchnorrSecp256k1Signature-cpu-arguments-slope": 32260, - "verifySchnorrSecp256k1Signature-memory-arguments": 10 - } + "PlutusV3": { + "addInteger-cpu-arguments-intercept": 100788, + "addInteger-cpu-arguments-slope": 420, + "addInteger-memory-arguments-intercept": 1, + "addInteger-memory-arguments-slope": 1, + "appendByteString-cpu-arguments-intercept": 1000, + "appendByteString-cpu-arguments-slope": 173, + "appendByteString-memory-arguments-intercept": 0, + "appendByteString-memory-arguments-slope": 1, + "appendString-cpu-arguments-intercept": 1000, + "appendString-cpu-arguments-slope": 59957, + "appendString-memory-arguments-intercept": 4, + "appendString-memory-arguments-slope": 1, + "bData-cpu-arguments": 11183, + "bData-memory-arguments": 32, + "blake2b_224-cpu-arguments-intercept": 207616, + "blake2b_224-cpu-arguments-slope": 8310, + "blake2b_224-memory-arguments": 4, + "blake2b_256-cpu-arguments-intercept": 201305, + "blake2b_256-cpu-arguments-slope": 8356, + "blake2b_256-memory-arguments": 4, + "bls12_381_G1_add-cpu-arguments": 962335, + "bls12_381_G1_add-memory-arguments": 18, + "bls12_381_G1_compress-cpu-arguments": 2780678, + "bls12_381_G1_compress-memory-arguments": 6, + "bls12_381_G1_equal-cpu-arguments": 442008, + "bls12_381_G1_equal-memory-arguments": 1, + "bls12_381_G1_hashToGroup-cpu-arguments-intercept": 52538055, + "bls12_381_G1_hashToGroup-cpu-arguments-slope": 3756, + "bls12_381_G1_hashToGroup-memory-arguments": 18, + "bls12_381_G1_neg-cpu-arguments": 267929, + "bls12_381_G1_neg-memory-arguments": 18, + "bls12_381_G1_scalarMul-cpu-arguments-intercept": 76433006, + "bls12_381_G1_scalarMul-cpu-arguments-slope": 8868, + "bls12_381_G1_scalarMul-memory-arguments": 18, + "bls12_381_G1_uncompress-cpu-arguments": 52948122, + "bls12_381_G1_uncompress-memory-arguments": 18, + "bls12_381_G2_add-cpu-arguments": 1995836, + "bls12_381_G2_add-memory-arguments": 36, + "bls12_381_G2_compress-cpu-arguments": 3227919, + "bls12_381_G2_compress-memory-arguments": 12, + "bls12_381_G2_equal-cpu-arguments": 901022, + "bls12_381_G2_equal-memory-arguments": 1, + "bls12_381_G2_hashToGroup-cpu-arguments-intercept": 166917843, + "bls12_381_G2_hashToGroup-cpu-arguments-slope": 4307, + "bls12_381_G2_hashToGroup-memory-arguments": 36, + "bls12_381_G2_neg-cpu-arguments": 284546, + "bls12_381_G2_neg-memory-arguments": 36, + "bls12_381_G2_scalarMul-cpu-arguments-intercept": 158221314, + "bls12_381_G2_scalarMul-cpu-arguments-slope": 26549, + "bls12_381_G2_scalarMul-memory-arguments": 36, + "bls12_381_G2_uncompress-cpu-arguments": 74698472, + "bls12_381_G2_uncompress-memory-arguments": 36, + "bls12_381_finalVerify-cpu-arguments": 333849714, + "bls12_381_finalVerify-memory-arguments": 1, + "bls12_381_millerLoop-cpu-arguments": 254006273, + "bls12_381_millerLoop-memory-arguments": 72, + "bls12_381_mulMlResult-cpu-arguments": 2174038, + "bls12_381_mulMlResult-memory-arguments": 72, + "byteStringToInteger-cpu-arguments-c0": 1006041, + "byteStringToInteger-cpu-arguments-c1": 43623, + "byteStringToInteger-cpu-arguments-c2": 251, + "byteStringToInteger-memory-arguments-intercept": 0, + "byteStringToInteger-memory-arguments-slope": 1, + "cekApplyCost-exBudgetCPU": 16000, + "cekApplyCost-exBudgetMemory": 100, + "cekBuiltinCost-exBudgetCPU": 16000, + "cekBuiltinCost-exBudgetMemory": 100, + "cekCaseCost-exBudgetCPU": 16000, + "cekCaseCost-exBudgetMemory": 100, + "cekConstCost-exBudgetCPU": 16000, + "cekConstCost-exBudgetMemory": 100, + "cekConstrCost-exBudgetCPU": 16000, + "cekConstrCost-exBudgetMemory": 100, + "cekDelayCost-exBudgetCPU": 16000, + "cekDelayCost-exBudgetMemory": 100, + "cekForceCost-exBudgetCPU": 16000, + "cekForceCost-exBudgetMemory": 100, + "cekLamCost-exBudgetCPU": 16000, + "cekLamCost-exBudgetMemory": 100, + "cekStartupCost-exBudgetCPU": 100, + "cekStartupCost-exBudgetMemory": 100, + "cekVarCost-exBudgetCPU": 16000, + "cekVarCost-exBudgetMemory": 100, + "chooseData-cpu-arguments": 94375, + "chooseData-memory-arguments": 32, + "chooseList-cpu-arguments": 132994, + "chooseList-memory-arguments": 32, + "chooseUnit-cpu-arguments": 61462, + "chooseUnit-memory-arguments": 4, + "consByteString-cpu-arguments-intercept": 72010, + "consByteString-cpu-arguments-slope": 178, + "consByteString-memory-arguments-intercept": 0, + "consByteString-memory-arguments-slope": 1, + "constrData-cpu-arguments": 22151, + "constrData-memory-arguments": 32, + "decodeUtf8-cpu-arguments-intercept": 91189, + "decodeUtf8-cpu-arguments-slope": 769, + "decodeUtf8-memory-arguments-intercept": 4, + "decodeUtf8-memory-arguments-slope": 2, + "divideInteger-cpu-arguments-constant": 85848, + "divideInteger-cpu-arguments-model-arguments-intercept": 228465, + "divideInteger-cpu-arguments-model-arguments-slope": 122, + "divideInteger-memory-arguments-intercept": 0, + "divideInteger-memory-arguments-minimum": 1, + "divideInteger-memory-arguments-slope": 1, + "encodeUtf8-cpu-arguments-intercept": 1000, + "encodeUtf8-cpu-arguments-slope": 42921, + "encodeUtf8-memory-arguments-intercept": 4, + "encodeUtf8-memory-arguments-slope": 2, + "equalsByteString-cpu-arguments-constant": 24548, + "equalsByteString-cpu-arguments-intercept": 29498, + "equalsByteString-cpu-arguments-slope": 38, + "equalsByteString-memory-arguments": 1, + "equalsData-cpu-arguments-intercept": 898148, + "equalsData-cpu-arguments-slope": 27279, + "equalsData-memory-arguments": 1, + "equalsInteger-cpu-arguments-intercept": 51775, + "equalsInteger-cpu-arguments-slope": 558, + "equalsInteger-memory-arguments": 1, + "equalsString-cpu-arguments-constant": 39184, + "equalsString-cpu-arguments-intercept": 1000, + "equalsString-cpu-arguments-slope": 60594, + "equalsString-memory-arguments": 1, + "fstPair-cpu-arguments": 141895, + "fstPair-memory-arguments": 32, + "headList-cpu-arguments": 83150, + "headList-memory-arguments": 32, + "iData-cpu-arguments": 15299, + "iData-memory-arguments": 32, + "ifThenElse-cpu-arguments": 76049, + "ifThenElse-memory-arguments": 1, + "indexByteString-cpu-arguments": 13169, + "indexByteString-memory-arguments": 4, + "integerToByteString-cpu-arguments-c0": 1293828, + "integerToByteString-cpu-arguments-c1": 28716, + "integerToByteString-cpu-arguments-c2": 63, + "integerToByteString-memory-arguments-intercept": 0, + "integerToByteString-memory-arguments-slope": 1, + "keccak_256-cpu-arguments-intercept": 2261318, + "keccak_256-cpu-arguments-slope": 64571, + "keccak_256-memory-arguments": 4, + "lengthOfByteString-cpu-arguments": 22100, + "lengthOfByteString-memory-arguments": 10, + "lessThanByteString-cpu-arguments-intercept": 28999, + "lessThanByteString-cpu-arguments-slope": 74, + "lessThanByteString-memory-arguments": 1, + "lessThanEqualsByteString-cpu-arguments-intercept": 28999, + "lessThanEqualsByteString-cpu-arguments-slope": 74, + "lessThanEqualsByteString-memory-arguments": 1, + "lessThanEqualsInteger-cpu-arguments-intercept": 43285, + "lessThanEqualsInteger-cpu-arguments-slope": 552, + "lessThanEqualsInteger-memory-arguments": 1, + "lessThanInteger-cpu-arguments-intercept": 44749, + "lessThanInteger-cpu-arguments-slope": 541, + "lessThanInteger-memory-arguments": 1, + "listData-cpu-arguments": 33852, + "listData-memory-arguments": 32, + "mapData-cpu-arguments": 68246, + "mapData-memory-arguments": 32, + "mkCons-cpu-arguments": 72362, + "mkCons-memory-arguments": 32, + "mkNilData-cpu-arguments": 7243, + "mkNilData-memory-arguments": 32, + "mkNilPairData-cpu-arguments": 7391, + "mkNilPairData-memory-arguments": 32, + "mkPairData-cpu-arguments": 11546, + "mkPairData-memory-arguments": 32, + "modInteger-cpu-arguments-constant": 85848, + "modInteger-cpu-arguments-model-arguments-intercept": 228465, + "modInteger-cpu-arguments-model-arguments-slope": 122, + "modInteger-memory-arguments-intercept": 0, + "modInteger-memory-arguments-minimum": 1, + "modInteger-memory-arguments-slope": 1, + "multiplyInteger-cpu-arguments-intercept": 90434, + "multiplyInteger-cpu-arguments-slope": 519, + "multiplyInteger-memory-arguments-intercept": 0, + "multiplyInteger-memory-arguments-slope": 1, + "nullList-cpu-arguments": 74433, + "nullList-memory-arguments": 32, + "quotientInteger-cpu-arguments-constant": 85848, + "quotientInteger-cpu-arguments-model-arguments-intercept": 228465, + "quotientInteger-cpu-arguments-model-arguments-slope": 122, + "quotientInteger-memory-arguments-intercept": 0, + "quotientInteger-memory-arguments-minimum": 1, + "quotientInteger-memory-arguments-slope": 1, + "remainderInteger-cpu-arguments-constant": 85848, + "remainderInteger-cpu-arguments-model-arguments-intercept": 228465, + "remainderInteger-cpu-arguments-model-arguments-slope": 122, + "remainderInteger-memory-arguments-intercept": 0, + "remainderInteger-memory-arguments-minimum": 1, + "remainderInteger-memory-arguments-slope": 1, + "serialiseData-cpu-arguments-intercept": 955506, + "serialiseData-cpu-arguments-slope": 213312, + "serialiseData-memory-arguments-intercept": 0, + "serialiseData-memory-arguments-slope": 2, + "sha2_256-cpu-arguments-intercept": 270652, + "sha2_256-cpu-arguments-slope": 22588, + "sha2_256-memory-arguments": 4, + "sha3_256-cpu-arguments-intercept": 1457325, + "sha3_256-cpu-arguments-slope": 64566, + "sha3_256-memory-arguments": 4, + "sliceByteString-cpu-arguments-intercept": 20467, + "sliceByteString-cpu-arguments-slope": 1, + "sliceByteString-memory-arguments-intercept": 4, + "sliceByteString-memory-arguments-slope": 0, + "sndPair-cpu-arguments": 141992, + "sndPair-memory-arguments": 32, + "subtractInteger-cpu-arguments-intercept": 100788, + "subtractInteger-cpu-arguments-slope": 420, + "subtractInteger-memory-arguments-intercept": 1, + "subtractInteger-memory-arguments-slope": 1, + "tailList-cpu-arguments": 81663, + "tailList-memory-arguments": 32, + "trace-cpu-arguments": 59498, + "trace-memory-arguments": 32, + "unBData-cpu-arguments": 20142, + "unBData-memory-arguments": 32, + "unConstrData-cpu-arguments": 24588, + "unConstrData-memory-arguments": 32, + "unIData-cpu-arguments": 20744, + "unIData-memory-arguments": 32, + "unListData-cpu-arguments": 25933, + "unListData-memory-arguments": 32, + "unMapData-cpu-arguments": 24623, + "unMapData-memory-arguments": 32, + "verifyEcdsaSecp256k1Signature-cpu-arguments": 43053543, + "verifyEcdsaSecp256k1Signature-memory-arguments": 10, + "verifyEd25519Signature-cpu-arguments-intercept": 53384111, + "verifyEd25519Signature-cpu-arguments-slope": 14333, + "verifyEd25519Signature-memory-arguments": 10, + "verifySchnorrSecp256k1Signature-cpu-arguments-intercept": 43574283, + "verifySchnorrSecp256k1Signature-cpu-arguments-slope": 26308, + "verifySchnorrSecp256k1Signature-memory-arguments": 10 + } }, "decentralization": null, "executionUnitPrices": { diff --git a/bench/tx-generator/data/schnorr-secp256k1-loop.redeemer.json b/bench/tx-generator/data/schnorr-secp256k1-loop.redeemer.json deleted file mode 100644 index d1fd1990441..00000000000 --- a/bench/tx-generator/data/schnorr-secp256k1-loop.redeemer.json +++ /dev/null @@ -1 +0,0 @@ -{"constructor":0,"fields":[{"int":1000000},{"bytes":"599de3e582e2a3779208a210dfeae8f330b9af00a47a7fb22e9bb8ef596f301b"},{"bytes":"30303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030"},{"bytes":"5a56da88e6fd8419181dec4d3dd6997bab953d2fc71ab65e23cfc9e7e3d1a310613454a60f6703819a39fdac2a410a094442afd1fc083354443e8d8bb4461a9b"}]} \ No newline at end of file diff --git a/bench/tx-generator/test/ApiTest.hs b/bench/tx-generator/test/ApiTest.hs index 34bec085cfd..75f0b7a6e42 100644 --- a/bench/tx-generator/test/ApiTest.hs +++ b/bench/tx-generator/test/ApiTest.hs @@ -8,33 +8,19 @@ {-# OPTIONS_GHC -fno-warn-unused-imports #-} -{- HLINT ignore "Use map" -} +{- HLINT ignore "Use camelCase" -} -module Main (main) where - -import Control.Arrow -import Control.Monad -import Control.Monad.IO.Class -import Control.Monad.Trans.Except -import Control.Monad.Trans.Except.Extra -import Data.Aeson (FromJSON, eitherDecodeFileStrict', encode) -import qualified Data.ByteString.Lazy.Char8 as BSL (putStrLn) -import Data.List (sortOn) -import Data.Ord (comparing) -import GHC.Natural (Natural) -import Options.Applicative as Opt -import Options.Applicative.Common as Opt (runParserInfo) - -import System.Environment (getArgs) -import System.Exit (die, exitSuccess) -import System.FilePath +module Main (module Main) where import Cardano.Api import qualified Cardano.Api.Ledger as Api import Cardano.Api.Shelley (ProtocolParameters (..), fromPlutusData) + +import Cardano.Benchmarking.PlutusScripts +import Cardano.Benchmarking.PlutusScripts.CustomCallTypes import Cardano.Node.Configuration.POM (NodeConfiguration (..)) +import Cardano.Node.Protocol.Types import Cardano.Node.Types (AdjustFilePaths (..), GenesisFile (..)) - import Cardano.TxGenerator.Genesis import Cardano.TxGenerator.PlutusContext import Cardano.TxGenerator.Setup.NixService @@ -43,21 +29,23 @@ import Cardano.TxGenerator.Setup.Plutus import Cardano.TxGenerator.Setup.SigningKey import Cardano.TxGenerator.Types -import Cardano.Benchmarking.Script.Aeson (prettyPrint, prettyPrintOrdered, - prettyPrintYaml) -import Cardano.Benchmarking.Script.Selftest (testScript) -import Cardano.Benchmarking.Script.Types (SubmitMode (..)) - -#ifdef WITH_LIBRARY -import Cardano.Benchmarking.PlutusScripts -import Cardano.Benchmarking.PlutusScripts.CustomCallTypes -#endif - -import Cardano.Node.Protocol.Types - -import qualified PlutusTx +import Control.Exception (SomeException (..), try) +import Control.Monad +import Data.Aeson (FromJSON, eitherDecodeFileStrict') +import Data.Aeson.Encode.Pretty +import qualified Data.ByteString as BS (pack) +import qualified Data.ByteString.Lazy.Char8 as BSL (ByteString, pack, putStrLn, writeFile) +import Data.Either (rights) +import Data.Functor ((<&>)) +import GHC.Natural (Natural) +import Options.Applicative as Opt +import System.Directory (doesFileExist) +import System.Environment (getArgs) +import System.Exit (die, exitSuccess) +import System.FilePath import Paths_tx_generator +import qualified PlutusTx data CommandLine = CommandLine { @@ -173,11 +161,13 @@ checkPlutusBuiltin protoParamFile protocolParameters <- readProtocolParametersOrDie protoParamFile putStrLn "* done reading protocol parameters" forM_ bArgs $ \bArg -> do - let apiData = unsafeHashableScriptData $ toApiData bArg + let + apiData :: ScriptData + apiData = toApiData bArg putStrLn $ "* executing with mode: " ++ show (fst bArg) putStrLn "* custom script data in Cardano API format:" - BSL.putStrLn $ encode $ scriptDataToJson ScriptDataJsonDetailedSchema apiData - case preExecutePlutusScript protocolParameters script (getScriptData apiData) apiData of + printScriptData apiData + case preExecutePlutusScript protocolParameters script apiData (unsafeHashableScriptData apiData) of Left err -> putStrLn $ "--> execution failed: " ++ show err Right units -> putStrLn $ "--> execution successful; got budget: " ++ show units where @@ -196,26 +186,28 @@ checkPlutusLoop :: FilePath -> Maybe TxGenPlutusParams -> IO () -checkPlutusLoop protoParamFile (Just PlutusOn{..}) +checkPlutusLoop protoParamFile (Just _plutusDef@PlutusOn{..}) = do script <- either (die . show) pure =<< readPlutusScript plutusScript - putStrLn $ "--> Read plutus script: " ++ (id ||| id) plutusScript + putStrLn $ "--> Read plutus script: " ++ scriptName protocolParameters <- readProtocolParametersOrDie protoParamFile - let count = 1_792 -- arbitrary counter for a loop script; should respect mainnet limits + let count = 1_792 -- arbitrary counter for a loop script; should respect mainnet limits - redeemerFile <- getRedeemerFile - redeemer <- readScriptData redeemerFile >>= \case - Left err -> die (show err) - Right redeemer -> do - putStrLn $ "--> read redeemer: " ++ redeemerFile - return $ scriptDataModifyNumber (+ count) $ getScriptData redeemer + let redeemerDef = Right _plutusDef + -- let redeemerDef = Left hashAndAddG2_redeemer + + + redeemer :: ScriptData <- + resolveRedeemer redeemerDef >>= either + (die . show) + (pure . scriptDataModifyNumber (+ count) . getScriptData) + printScriptData redeemer case preExecutePlutusScript protocolParameters script (ScriptDataNumber 0) (unsafeHashableScriptData redeemer) of Left err -> putStrLn $ "--> execution failed: " ++ show err Right units -> putStrLn $ "--> execution successful; got budget: " ++ show units - putStrLn "* What does the redeemer look like when the loop counter is maxed out?" let budget = case protocolParamMaxTxExUnits protocolParameters of Just x -> x Nothing -> error "Cannot find protocolParamMaxTxExUnits" @@ -231,26 +223,46 @@ checkPlutusLoop protoParamFile (Just PlutusOn{..}) } } Nothing -> protocolParameters - putStrLn $ "--> " ++ show (plutusAutoBudgetMaxOut protocolParameters script autoBudget TargetTxExpenditure 1) + + -- putStrLn "* What does the redeemer look like when the loop counter is maxed out?" + -- putStrLn $ "--> " ++ show (plutusAutoBudgetMaxOut protocolParameters script autoBudget TargetTxExpenditure 1) let blockMaxOut b d = - case plutusAutoScaleBlockfit (pparamsStepFraction d) ("factor for block execution steps: " ++ show d) script b (TargetTxsPerBlock 8) 1 of - Right (summary, _, _) -> BSL.putStrLn $ prettyPrintOrdered summary - Left err -> print err + case plutusAutoScaleBlockfit (pparamsStepFraction d) (scriptName ++ idPath) script b (TargetTxsPerBlock 8) 1 of + Right (summary, _, _) -> Right summary + Left err -> Left $ BSL.pack $ show err + where + idPath = "/blockbudget" ++ if d == 1.0 then "" else "/steps_x" ++ show d + + txMaxOut b = + case plutusAutoScaleBlockfit protocolParameters (scriptName ++ "/txbudget") script b TargetTxExpenditure 1 of + Right (summary, _, _) -> Right summary + Left err -> Left $ BSL.pack $ show err + + putStrLn "--> summary for tx budget fit:" + let txBudg = txMaxOut autoBudget + BSL.putStrLn $ either id encodePrettySorted txBudg putStrLn "--> summaries for block budget fits:" - mapM_ (blockMaxOut autoBudget) [1.0, 0.5, 2.0] + blockBudgs <- forM [1.0, 0.5, 2.0] $ \factor -> do + let blockBudg = blockMaxOut autoBudget factor + BSL.putStrLn $ either id encodePrettySorted blockBudg + pure blockBudg + + let + summaries :: [PlutusBudgetSummary] + summaries = rights (txBudg : blockBudgs) + summaryName = "summaries_" ++ scriptName <.> "json" + putStrLn $ "--> writing summaries to " ++ summaryName + BSL.writeFile summaryName (encodePrettySorted summaries) where mul :: Natural -> Double -> Natural mul n d = floor $ d * fromIntegral n - getRedeemerFile - = case plutusScript of - Right file -> let redeemerPath = (<.> ".redeemer.json") $ dropExtension $ takeFileName file - in getDataFileName $ "data" redeemerPath - Left _ -> getDataFileName "data/loop.redeemer.json" + scriptName = fromEither plutusScript + checkPlutusLoop _ _ = putStrLn "--> No plutus script defined." @@ -268,6 +280,39 @@ readProtocolParametersOrDie filePath parametersFile <- getDataFileName filePath either die pure =<< eitherDecodeFileStrict' parametersFile +resolveRedeemer :: Either ScriptData TxGenPlutusParams -> IO (Either TxGenError HashableScriptData) +resolveRedeemer (Left hsd) = do + putStrLn "--> a hard-coded redeemer has been provided" + pure $ Right $ unsafeHashableScriptData hsd +resolveRedeemer (Right PlutusOn{..}) = + case plutusScript of + -- it's a file path: we rely on a redeemer file that's been passed explicitly + Right{} -> loader plutusRedeemer + + -- it's a built-in, either from the library or from scripts-fallback/ + -- 1. an explicitly passed in redeemer file takes precedence + -- 2. a fallback redeemer is resolved from data/ by adding .redeemer.json + -- NB: while scripts-fallback/ content might be used in production, data/ should *NEVER* be - it's for tx-generator development and testing only + Left n -> do + let fallbackName = "data" n <.> "redeemer" <.> "json" + fileExists <- maybe (pure False) doesFileExist plutusRedeemer + fallbackFile <- try (getDataFileName fallbackName) <&> either (\SomeException{} -> "") id + loader $ if fileExists then plutusRedeemer else Just fallbackFile + where + loader = \case + Just f@(_:_) -> do + putStrLn $ "--> will read redeemer from: " ++ f + readScriptData f + _ -> pure $ Left $ TxGenError "resolveRedeemer: no redeemer file resolved" + +resolveRedeemer _ = pure $ Left $ TxGenError "resolveRedeemer: no Plutus script defined" + +fromEither :: Either a a -> a +fromEither = either id id + +encodePrettySorted :: ToJSON a => a -> BSL.ByteString +encodePrettySorted = encodePretty' defConfig { confCompare = compare } + -- -- command line parsing @@ -310,3 +355,32 @@ parserCommandLine <> help "The Nix service definition JSON file" <> completer (bashCompleter "file") ) + +-- +-- test data +-- + +loop_redeemer :: ScriptData +loop_redeemer = ScriptDataNumber 1_000_000 + +hashAndAddG2_redeemer :: ScriptData +hashAndAddG2_redeemer = + ScriptDataConstructor 0 + [ ScriptDataNumber 1_000_000 + , ScriptDataList + [ mkBytes [ 113, 72 , 5, 198 ] + , mkBytes [ 196, 19 , 17, 30 ] + -- , mkBytes [ 45, 126, 184, 112 ] + -- , mkBytes [ 78, 203, 214, 161 ] + ] + ] + where + mkBytes = ScriptDataBytes . BS.pack + + +printScriptData :: ScriptData -> IO () +printScriptData = + BSL.putStrLn + . encodePretty + . scriptDataToJson ScriptDataJsonDetailedSchema + . unsafeHashableScriptData diff --git a/bench/tx-generator/tx-generator.cabal b/bench/tx-generator/tx-generator.cabal index 57c4ee91bc5..68279289cb3 100644 --- a/bench/tx-generator/tx-generator.cabal +++ b/bench/tx-generator/tx-generator.cabal @@ -195,7 +195,9 @@ test-suite tx-generator-apitest build-depends: base , aeson + , aeson-pretty , bytestring + , directory , filepath , optparse-applicative-fork , cardano-api From e498e4e9a64edf1979d5b77f33783192e888561a Mon Sep 17 00:00:00 2001 From: Michael Karg Date: Wed, 15 May 2024 15:50:42 +0200 Subject: [PATCH 04/21] serialized version; no-full-laziness --- bench/plutus-scripts-bench/app/gen-plutus.hs | 3 ++- bench/plutus-scripts-bench/plutus-scripts-bench.cabal | 3 +-- bench/tx-generator/scripts-fallback/HashOntoG2AndAdd.plutus | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 bench/tx-generator/scripts-fallback/HashOntoG2AndAdd.plutus diff --git a/bench/plutus-scripts-bench/app/gen-plutus.hs b/bench/plutus-scripts-bench/app/gen-plutus.hs index 010d501b2f3..f9c8444e00a 100644 --- a/bench/plutus-scripts-bench/app/gen-plutus.hs +++ b/bench/plutus-scripts-bench/app/gen-plutus.hs @@ -7,7 +7,7 @@ import qualified Data.ByteString.Lazy as LBS (hPut) import Data.List (sort) import Options.Applicative import System.Exit (die) -import System.IO (IOMode (..), openFile, stdout) +import System.IO (IOMode (..), openFile, stdout, hClose) data Options = List @@ -48,3 +48,4 @@ main = customExecParser pref (info opts fullDesc) >>= \case Just file -> openFile file WriteMode Nothing -> pure stdout LBS.hPut h $ encodePlutusScript s + hClose h diff --git a/bench/plutus-scripts-bench/plutus-scripts-bench.cabal b/bench/plutus-scripts-bench/plutus-scripts-bench.cabal index 43778b286e9..6c6937a8a1a 100644 --- a/bench/plutus-scripts-bench/plutus-scripts-bench.cabal +++ b/bench/plutus-scripts-bench/plutus-scripts-bench.cabal @@ -50,8 +50,7 @@ common common-definitions -fno-specialise -fno-spec-constr -fno-strictness -fno-ignore-interface-pragmas -fno-omit-interface-pragmas -fno-unbox-strict-fields -fno-unbox-small-strict-fields - -fobject-code - -- TODO: what about? -fno-full-laziness + -fobject-code -fno-full-laziness if flag(defer-plugin-errors) ghc-options: -fplugin-opt PlutusTx.Plugin:defer-errors diff --git a/bench/tx-generator/scripts-fallback/HashOntoG2AndAdd.plutus b/bench/tx-generator/scripts-fallback/HashOntoG2AndAdd.plutus new file mode 100644 index 00000000000..af36e883c59 --- /dev/null +++ b/bench/tx-generator/scripts-fallback/HashOntoG2AndAdd.plutus @@ -0,0 +1,5 @@ +{ + "type": "PlutusScriptV3", + "description": "", + "cborHex": "59020959020601010032323232322225329333333006003225333573466e1d200000215933335573e00250022800c004d5d08014d5d1001100090c800c8964cccccc02c0088a0045002280114004004500290ac9999aab9f00228011191940040086ae88010d5d0801c00242b266666601a00245002280100614008a00521800c00400e002460048c009180111801060045002280114008a005219001912999ab9a33710004904044bd0980224811572656465656d6572206973203c20313030303030300013300a00200144c005240110696e76616c69642072656465656d657200119319ab9c0018001802111999aab9f0012800c0004b26666660086ae840088a0045002280114008a00200290ac98021aba200390c0060060050012300244ca00460066ae880090002222223333333574800c4646600e6aae74004d55cf0009baa00723005375600e460086eb001c8c00cdd6803918011bae00780018011112999ab9a3370e904044bd0010c0004c8cc010cdc0801a4004004660080026f09220160c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003001222590028800c884cc014004cdde99bc300248810000311918008009119801980100100081" +} From f09a412b7457df3ed20aff598d833383ac7f0cfc Mon Sep 17 00:00:00 2001 From: Michael Karg Date: Thu, 16 May 2024 09:31:46 +0200 Subject: [PATCH 05/21] wb | profiles: remove deprecated mimic-ops overlay --- .../profile/pparams/delta-mimicops.jq | 118 ------------------ nix/workbench/profile/prof1-variants.jq | 5 - nix/workbench/profile/prof2-pparams.jq | 2 - 3 files changed, 125 deletions(-) delete mode 100644 nix/workbench/profile/pparams/delta-mimicops.jq diff --git a/nix/workbench/profile/pparams/delta-mimicops.jq b/nix/workbench/profile/pparams/delta-mimicops.jq deleted file mode 100644 index 9c7926794ee..00000000000 --- a/nix/workbench/profile/pparams/delta-mimicops.jq +++ /dev/null @@ -1,118 +0,0 @@ -def delta: -{ - "alonzo": { - "coinsPerUTxOByte": 4310 - }, - "shelley": { - "protocolVersion": { - "major": 5 - }, - }, - "costModels": { - "PlutusV1": { - "addInteger-cpu-arguments-intercept": 205665, - "addInteger-cpu-arguments-slope": 812, - "appendByteString-cpu-arguments-intercept": 1000, - "appendByteString-cpu-arguments-slope": 571, - "appendString-cpu-arguments-intercept": 1000, - "appendString-cpu-arguments-slope": 24177, - "appendString-memory-arguments-intercept": 4, - "bData-cpu-arguments": 1000, - "blake2b-cpu-arguments-intercept": 117366, - "blake2b-cpu-arguments-slope": 10475, - "blake2b-memory-arguments": 4, - "cekApplyCost-exBudgetCPU": 23000, - "cekBuiltinCost-exBudgetCPU": 23000, - "cekConstCost-exBudgetCPU": 23000, - "cekDelayCost-exBudgetCPU": 23000, - "cekForceCost-exBudgetCPU": 23000, - "cekLamCost-exBudgetCPU": 23000, - "cekVarCost-exBudgetCPU": 23000, - "chooseData-cpu-arguments": 19537, - "chooseList-cpu-arguments": 175354, - "chooseUnit-cpu-arguments": 46417, - "chooseUnit-memory-arguments": 4, - "consByteString-cpu-arguments-intercept": 221973, - "consByteString-cpu-arguments-slope": 511, - "constrData-cpu-arguments": 89141, - "decodeUtf8-cpu-arguments-intercept": 497525, - "decodeUtf8-cpu-arguments-slope": 14068, - "decodeUtf8-memory-arguments-intercept": 4, - "decodeUtf8-memory-arguments-slope": 2, - "divideInteger-cpu-arguments-constant": 196500, - "divideInteger-cpu-arguments-model-arguments-intercept": 453240, - "divideInteger-cpu-arguments-model-arguments-slope": 220, - "encodeUtf8-cpu-arguments-intercept": 1000, - "encodeUtf8-cpu-arguments-slope": 28662, - "encodeUtf8-memory-arguments-intercept": 4, - "encodeUtf8-memory-arguments-slope": 2, - "equalsByteString-cpu-arguments-constant": 245000, - "equalsByteString-cpu-arguments-intercept": 216773, - "equalsByteString-cpu-arguments-slope": 62, - "equalsData-cpu-arguments-intercept": 1060367, - "equalsData-cpu-arguments-slope": 12586, - "equalsInteger-cpu-arguments-intercept": 208512, - "equalsInteger-cpu-arguments-slope": 421, - "equalsString-cpu-arguments-constant": 187000, - "equalsString-cpu-arguments-intercept": 1000, - "equalsString-cpu-arguments-slope": 52998, - "fstPair-cpu-arguments": 80436, - "headList-cpu-arguments": 43249, - "iData-cpu-arguments": 1000, - "ifThenElse-cpu-arguments": 80556, - "indexByteString-cpu-arguments": 57667, - "indexByteString-memory-arguments": 4, - "lengthOfByteString-cpu-arguments": 1000, - "lengthOfByteString-memory-arguments": 10, - "lessThanByteString-cpu-arguments-intercept": 197145, - "lessThanByteString-cpu-arguments-slope": 156, - "lessThanEqualsByteString-cpu-arguments-intercept": 197145, - "lessThanEqualsByteString-cpu-arguments-slope": 156, - "lessThanEqualsInteger-cpu-arguments-intercept": 204924, - "lessThanEqualsInteger-cpu-arguments-slope": 473, - "lessThanInteger-cpu-arguments-intercept": 208896, - "lessThanInteger-cpu-arguments-slope": 511, - "listData-cpu-arguments": 52467, - "mapData-cpu-arguments": 64832, - "mkCons-cpu-arguments": 65493, - "mkNilData-cpu-arguments": 22558, - "mkNilPairData-cpu-arguments": 16563, - "mkPairData-cpu-arguments": 76511, - "modInteger-cpu-arguments-constant": 196500, - "modInteger-cpu-arguments-model-arguments-intercept": 453240, - "modInteger-cpu-arguments-model-arguments-slope": 220, - "multiplyInteger-cpu-arguments-intercept": 69522, - "multiplyInteger-cpu-arguments-slope": 11687, - "nullList-cpu-arguments": 60091, - "quotientInteger-cpu-arguments-constant": 196500, - "quotientInteger-cpu-arguments-model-arguments-intercept": 453240, - "quotientInteger-cpu-arguments-model-arguments-slope": 220, - "remainderInteger-cpu-arguments-constant": 196500, - "remainderInteger-cpu-arguments-model-arguments-intercept": 453240, - "remainderInteger-cpu-arguments-model-arguments-slope": 220, - "sha2_256-cpu-arguments-intercept": 806990, - "sha2_256-cpu-arguments-slope": 30482, - "sha3_256-cpu-arguments-intercept": 1927926, - "sha3_256-cpu-arguments-slope": 82523, - "sliceByteString-cpu-arguments-intercept": 265318, - "sliceByteString-cpu-arguments-slope": 0, - "sliceByteString-memory-arguments-intercept": 4, - "sliceByteString-memory-arguments-slope": 0, - "sndPair-cpu-arguments": 85931, - "subtractInteger-cpu-arguments-intercept": 205665, - "subtractInteger-cpu-arguments-slope": 812, - "tailList-cpu-arguments": 41182, - "trace-cpu-arguments": 212342, - "unBData-cpu-arguments": 31220, - "unConstrData-cpu-arguments": 32696, - "unIData-cpu-arguments": 43357, - "unListData-cpu-arguments": 32247, - "unMapData-cpu-arguments": 38314, - "verifyEd25519Signature-cpu-arguments-intercept": 9462713, - "verifyEd25519Signature-cpu-arguments-slope": 1021, - "verifyEd25519Signature-memory-arguments": 10 - }, - "PlutusV2": { - } - } -}; diff --git a/nix/workbench/profile/prof1-variants.jq b/nix/workbench/profile/prof1-variants.jq index b980af1de18..4904e409cfc 100644 --- a/nix/workbench/profile/prof1-variants.jq +++ b/nix/workbench/profile/prof1-variants.jq @@ -498,11 +498,6 @@ def all_profile_variants: | .genesis.pparamsEpoch = timeline::lastKnownEpoch | .genesis.pparamsOverlays = ["v8-preview", "doublebudget"] ) as $costmodel_v8_preview_doubleb - | - ({} - | .genesis.pparamsEpoch = timeline::lastKnownEpoch - | .genesis.pparamsOverlays = ["mimic-ops"] - ) as $mimic_ops_params ## ### Definition vocabulary: node + tracer config variants ## diff --git a/nix/workbench/profile/prof2-pparams.jq b/nix/workbench/profile/prof2-pparams.jq index abda8805553..da7fbbbf24a 100644 --- a/nix/workbench/profile/prof2-pparams.jq +++ b/nix/workbench/profile/prof2-pparams.jq @@ -4,7 +4,6 @@ import "epoch-timeline" as timeline; import "delta-blockbudget" as blockbudget; import "delta-v8-preview" as v8preview; -import "delta-mimicops" as mimicops; def filterMapPParams(flt; map): timeline::epochs @@ -27,7 +26,6 @@ def overlays: { "doublebudget": blockbudget::delta_doublebudget , "stepshalf": blockbudget::delta_stepshalf , "v8-preview": v8preview::delta - , "mimic-ops": mimicops::delta }; def pParamsWithOverlays(epoch; overlay_names): From 3fc17900dc69855fd6bfa897745db8dc271159b0 Mon Sep 17 00:00:00 2001 From: Michael Karg Date: Thu, 16 May 2024 10:10:55 +0200 Subject: [PATCH 06/21] PlutusV3 ci-bench workload; fee estimate in budget summary --- Makefile | 1 + .../src/Cardano/Benchmarking/Script/Core.hs | 11 +- .../src/Cardano/TxGenerator/PlutusContext.hs | 24 +- .../profile/pparams/delta-v9-preview.jq | 250 ++++++++++++++++++ nix/workbench/profile/prof1-variants.jq | 36 +++ nix/workbench/profile/prof2-pparams.jq | 2 + nix/workbench/service/tracing.nix | 4 + 7 files changed, 317 insertions(+), 11 deletions(-) create mode 100644 nix/workbench/profile/pparams/delta-v9-preview.jq diff --git a/Makefile b/Makefile index 9ec272dbde2..f051be4d99f 100644 --- a/Makefile +++ b/Makefile @@ -78,6 +78,7 @@ PROFILES_BASE := default default-p2p plutus plutus-secp-ecdsa plutus PROFILES_FAST := fast fast-p2p fast-plutus fast-notracer fast-oldtracing faststartup-24M PROFILES_CI_TEST := ci-test ci-test-p2p ci-test-plutus ci-test-notracer ci-test-rtview ci-test-dense10 PROFILES_CI_BENCH := ci-bench ci-bench-p2p ci-bench-plutus ci-bench-plutus-secp-ecdsa ci-bench-plutus-secp-schnorr ci-bench-notracer ci-bench-rtview ci-bench-lmdb ci-bench-drep +PROFILES_CI_BENCH += ci-bench-plutusv3-blst PROFILES_TRACE_BENCH := trace-bench trace-bench-notracer trace-bench-oldtracing trace-bench-rtview PROFILES_TRACE_FULL := trace-full trace-full-rtview PROFILES_EPOCHTRANS := epoch-transition diff --git a/bench/tx-generator/src/Cardano/Benchmarking/Script/Core.hs b/bench/tx-generator/src/Cardano/Benchmarking/Script/Core.hs index 5aa9e8a5a0a..8d78e4a9790 100644 --- a/bench/tx-generator/src/Cardano/Benchmarking/Script/Core.hs +++ b/bench/tx-generator/src/Cardano/Benchmarking/Script/Core.hs @@ -350,11 +350,18 @@ evalGenerator generator txParams@TxGenTxParams{txParamFee = fee} era = do case sourceTransactionPreview txGenerator fundPreview inToOut (mangle $ repeat toUTxO) of Left err -> traceDebug $ "Error creating Tx preview: " ++ show err Right tx -> do - let txSize = txSizeInBytes tx + let + txSize = txSizeInBytes tx + txFeeEstimate = case toLedgerPParams shelleyBasedEra protocolParameters of + Left{} -> Nothing + Right ledgerPParams -> Just $ + evaluateTransactionFee shelleyBasedEra ledgerPParams (getTxBody tx) (fromIntegral $ inputs + 1) 0 0 -- 1 key witness per tx input + 1 collateral traceDebug $ "Projected Tx size in bytes: " ++ show txSize + traceDebug $ "Projected Tx fee in Coin: " ++ show txFeeEstimate + -- TODO: possibly emit a warning when (Just txFeeEstimate) is lower than specified by config in TxGenTxParams.txFee summary_ <- getEnvSummary forM_ summary_ $ \summary -> do - let summary' = summary {projectedTxSize = Just txSize} + let summary' = summary { projectedTxSize = Just txSize, projectedTxFee = txFeeEstimate } setEnvSummary summary' traceBenchTxSubmit TraceBenchPlutusBudgetSummary summary' dumpBudgetSummaryIfExisting diff --git a/bench/tx-generator/src/Cardano/TxGenerator/PlutusContext.hs b/bench/tx-generator/src/Cardano/TxGenerator/PlutusContext.hs index 329b82eaafa..f748286a96c 100644 --- a/bench/tx-generator/src/Cardano/TxGenerator/PlutusContext.hs +++ b/bench/tx-generator/src/Cardano/TxGenerator/PlutusContext.hs @@ -7,6 +7,7 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} {-# OPTIONS_GHC -fno-warn-overlapping-patterns #-} +{-# OPTIONS_GHC -fno-warn-unused-imports #-} {- Module : Cardano.TxGenerator.PlutusContext @@ -24,20 +25,20 @@ module Cardano.TxGenerator.PlutusContext ) where -import GHC.Generics (Generic) -import GHC.Natural (Natural) - -import Control.Monad.Trans.Except.Extra -import Data.Aeson as Aeson -import Data.List (maximumBy, minimumBy) -import Data.Ord (comparing) - import Cardano.Api import Cardano.Api.Shelley (ProtocolParameters (..)) +import Cardano.Ledger.Coin (Coin) import Cardano.TxGenerator.Setup.Plutus (preExecutePlutusScript) import Cardano.TxGenerator.Types +import Control.Monad.Trans.Except.Extra +import Data.Aeson as Aeson +import Data.List (maximumBy, minimumBy) +import Data.Ord (comparing) +import GHC.Generics (Generic) +import GHC.Natural (Natural) + -- | This collects information describing the budget. It's only -- directly referenced in "Cardano.Benchmarking.Script.Env" to supply @@ -62,9 +63,13 @@ data PlutusBudgetSummary = , projectedTxPerBlock :: !Int , projectedLoopsPerBlock :: !Int , projectedTxSize :: !(Maybe Int) + , projectedTxFee :: !(Maybe Coin) , strategyMessage :: !(Maybe String) } - deriving (Generic, Show, ToJSON) + deriving (Generic, Show) + +instance ToJSON PlutusBudgetSummary where + toJSON = genericToJSON defaultOptions { omitNothingFields = True } -- | Nothing references this type's name or uses its constructors -- outside this module. @@ -223,6 +228,7 @@ plutusBudgetSummary = PlutusBudgetSummary{..} where projectedTxSize = Nothing -- we defer this value until after splitting phase + projectedTxFee = Nothing -- we defer this value until after splitting phase strategyMessage = Nothing scriptArgDatum = autoBudgetDatum scriptArgRedeemer = getScriptData autoBudgetRedeemer diff --git a/nix/workbench/profile/pparams/delta-v9-preview.jq b/nix/workbench/profile/pparams/delta-v9-preview.jq new file mode 100644 index 00000000000..3a6138a9ebf --- /dev/null +++ b/nix/workbench/profile/pparams/delta-v9-preview.jq @@ -0,0 +1,250 @@ +## this delta does not include v8 preview changes +def delta: +{ + "shelley": { + "protocolVersion": { + "major": 9 + }, + }, + "costModels": { + "PlutusV1": { + }, + "PlutusV2": { + }, + "PlutusV3": { + "addInteger-cpu-arguments-intercept": 100788, + "addInteger-cpu-arguments-slope": 420, + "addInteger-memory-arguments-intercept": 1, + "addInteger-memory-arguments-slope": 1, + "appendByteString-cpu-arguments-intercept": 1000, + "appendByteString-cpu-arguments-slope": 173, + "appendByteString-memory-arguments-intercept": 0, + "appendByteString-memory-arguments-slope": 1, + "appendString-cpu-arguments-intercept": 1000, + "appendString-cpu-arguments-slope": 59957, + "appendString-memory-arguments-intercept": 4, + "appendString-memory-arguments-slope": 1, + "bData-cpu-arguments": 11183, + "bData-memory-arguments": 32, + "blake2b_224-cpu-arguments-intercept": 207616, + "blake2b_224-cpu-arguments-slope": 8310, + "blake2b_224-memory-arguments": 4, + "blake2b_256-cpu-arguments-intercept": 201305, + "blake2b_256-cpu-arguments-slope": 8356, + "blake2b_256-memory-arguments": 4, + "bls12_381_G1_add-cpu-arguments": 962335, + "bls12_381_G1_add-memory-arguments": 18, + "bls12_381_G1_compress-cpu-arguments": 2780678, + "bls12_381_G1_compress-memory-arguments": 6, + "bls12_381_G1_equal-cpu-arguments": 442008, + "bls12_381_G1_equal-memory-arguments": 1, + "bls12_381_G1_hashToGroup-cpu-arguments-intercept": 52538055, + "bls12_381_G1_hashToGroup-cpu-arguments-slope": 3756, + "bls12_381_G1_hashToGroup-memory-arguments": 18, + "bls12_381_G1_neg-cpu-arguments": 267929, + "bls12_381_G1_neg-memory-arguments": 18, + "bls12_381_G1_scalarMul-cpu-arguments-intercept": 76433006, + "bls12_381_G1_scalarMul-cpu-arguments-slope": 8868, + "bls12_381_G1_scalarMul-memory-arguments": 18, + "bls12_381_G1_uncompress-cpu-arguments": 52948122, + "bls12_381_G1_uncompress-memory-arguments": 18, + "bls12_381_G2_add-cpu-arguments": 1995836, + "bls12_381_G2_add-memory-arguments": 36, + "bls12_381_G2_compress-cpu-arguments": 3227919, + "bls12_381_G2_compress-memory-arguments": 12, + "bls12_381_G2_equal-cpu-arguments": 901022, + "bls12_381_G2_equal-memory-arguments": 1, + "bls12_381_G2_hashToGroup-cpu-arguments-intercept": 166917843, + "bls12_381_G2_hashToGroup-cpu-arguments-slope": 4307, + "bls12_381_G2_hashToGroup-memory-arguments": 36, + "bls12_381_G2_neg-cpu-arguments": 284546, + "bls12_381_G2_neg-memory-arguments": 36, + "bls12_381_G2_scalarMul-cpu-arguments-intercept": 158221314, + "bls12_381_G2_scalarMul-cpu-arguments-slope": 26549, + "bls12_381_G2_scalarMul-memory-arguments": 36, + "bls12_381_G2_uncompress-cpu-arguments": 74698472, + "bls12_381_G2_uncompress-memory-arguments": 36, + "bls12_381_finalVerify-cpu-arguments": 333849714, + "bls12_381_finalVerify-memory-arguments": 1, + "bls12_381_millerLoop-cpu-arguments": 254006273, + "bls12_381_millerLoop-memory-arguments": 72, + "bls12_381_mulMlResult-cpu-arguments": 2174038, + "bls12_381_mulMlResult-memory-arguments": 72, + "byteStringToInteger-cpu-arguments-c0": 1006041, + "byteStringToInteger-cpu-arguments-c1": 43623, + "byteStringToInteger-cpu-arguments-c2": 251, + "byteStringToInteger-memory-arguments-intercept": 0, + "byteStringToInteger-memory-arguments-slope": 1, + "cekApplyCost-exBudgetCPU": 16000, + "cekApplyCost-exBudgetMemory": 100, + "cekBuiltinCost-exBudgetCPU": 16000, + "cekBuiltinCost-exBudgetMemory": 100, + "cekCaseCost-exBudgetCPU": 16000, + "cekCaseCost-exBudgetMemory": 100, + "cekConstCost-exBudgetCPU": 16000, + "cekConstCost-exBudgetMemory": 100, + "cekConstrCost-exBudgetCPU": 16000, + "cekConstrCost-exBudgetMemory": 100, + "cekDelayCost-exBudgetCPU": 16000, + "cekDelayCost-exBudgetMemory": 100, + "cekForceCost-exBudgetCPU": 16000, + "cekForceCost-exBudgetMemory": 100, + "cekLamCost-exBudgetCPU": 16000, + "cekLamCost-exBudgetMemory": 100, + "cekStartupCost-exBudgetCPU": 100, + "cekStartupCost-exBudgetMemory": 100, + "cekVarCost-exBudgetCPU": 16000, + "cekVarCost-exBudgetMemory": 100, + "chooseData-cpu-arguments": 94375, + "chooseData-memory-arguments": 32, + "chooseList-cpu-arguments": 132994, + "chooseList-memory-arguments": 32, + "chooseUnit-cpu-arguments": 61462, + "chooseUnit-memory-arguments": 4, + "consByteString-cpu-arguments-intercept": 72010, + "consByteString-cpu-arguments-slope": 178, + "consByteString-memory-arguments-intercept": 0, + "consByteString-memory-arguments-slope": 1, + "constrData-cpu-arguments": 22151, + "constrData-memory-arguments": 32, + "decodeUtf8-cpu-arguments-intercept": 91189, + "decodeUtf8-cpu-arguments-slope": 769, + "decodeUtf8-memory-arguments-intercept": 4, + "decodeUtf8-memory-arguments-slope": 2, + "divideInteger-cpu-arguments-constant": 85848, + "divideInteger-cpu-arguments-model-arguments-intercept": 228465, + "divideInteger-cpu-arguments-model-arguments-slope": 122, + "divideInteger-memory-arguments-intercept": 0, + "divideInteger-memory-arguments-minimum": 1, + "divideInteger-memory-arguments-slope": 1, + "encodeUtf8-cpu-arguments-intercept": 1000, + "encodeUtf8-cpu-arguments-slope": 42921, + "encodeUtf8-memory-arguments-intercept": 4, + "encodeUtf8-memory-arguments-slope": 2, + "equalsByteString-cpu-arguments-constant": 24548, + "equalsByteString-cpu-arguments-intercept": 29498, + "equalsByteString-cpu-arguments-slope": 38, + "equalsByteString-memory-arguments": 1, + "equalsData-cpu-arguments-intercept": 898148, + "equalsData-cpu-arguments-slope": 27279, + "equalsData-memory-arguments": 1, + "equalsInteger-cpu-arguments-intercept": 51775, + "equalsInteger-cpu-arguments-slope": 558, + "equalsInteger-memory-arguments": 1, + "equalsString-cpu-arguments-constant": 39184, + "equalsString-cpu-arguments-intercept": 1000, + "equalsString-cpu-arguments-slope": 60594, + "equalsString-memory-arguments": 1, + "fstPair-cpu-arguments": 141895, + "fstPair-memory-arguments": 32, + "headList-cpu-arguments": 83150, + "headList-memory-arguments": 32, + "iData-cpu-arguments": 15299, + "iData-memory-arguments": 32, + "ifThenElse-cpu-arguments": 76049, + "ifThenElse-memory-arguments": 1, + "indexByteString-cpu-arguments": 13169, + "indexByteString-memory-arguments": 4, + "integerToByteString-cpu-arguments-c0": 1293828, + "integerToByteString-cpu-arguments-c1": 28716, + "integerToByteString-cpu-arguments-c2": 63, + "integerToByteString-memory-arguments-intercept": 0, + "integerToByteString-memory-arguments-slope": 1, + "keccak_256-cpu-arguments-intercept": 2261318, + "keccak_256-cpu-arguments-slope": 64571, + "keccak_256-memory-arguments": 4, + "lengthOfByteString-cpu-arguments": 22100, + "lengthOfByteString-memory-arguments": 10, + "lessThanByteString-cpu-arguments-intercept": 28999, + "lessThanByteString-cpu-arguments-slope": 74, + "lessThanByteString-memory-arguments": 1, + "lessThanEqualsByteString-cpu-arguments-intercept": 28999, + "lessThanEqualsByteString-cpu-arguments-slope": 74, + "lessThanEqualsByteString-memory-arguments": 1, + "lessThanEqualsInteger-cpu-arguments-intercept": 43285, + "lessThanEqualsInteger-cpu-arguments-slope": 552, + "lessThanEqualsInteger-memory-arguments": 1, + "lessThanInteger-cpu-arguments-intercept": 44749, + "lessThanInteger-cpu-arguments-slope": 541, + "lessThanInteger-memory-arguments": 1, + "listData-cpu-arguments": 33852, + "listData-memory-arguments": 32, + "mapData-cpu-arguments": 68246, + "mapData-memory-arguments": 32, + "mkCons-cpu-arguments": 72362, + "mkCons-memory-arguments": 32, + "mkNilData-cpu-arguments": 7243, + "mkNilData-memory-arguments": 32, + "mkNilPairData-cpu-arguments": 7391, + "mkNilPairData-memory-arguments": 32, + "mkPairData-cpu-arguments": 11546, + "mkPairData-memory-arguments": 32, + "modInteger-cpu-arguments-constant": 85848, + "modInteger-cpu-arguments-model-arguments-intercept": 228465, + "modInteger-cpu-arguments-model-arguments-slope": 122, + "modInteger-memory-arguments-intercept": 0, + "modInteger-memory-arguments-minimum": 1, + "modInteger-memory-arguments-slope": 1, + "multiplyInteger-cpu-arguments-intercept": 90434, + "multiplyInteger-cpu-arguments-slope": 519, + "multiplyInteger-memory-arguments-intercept": 0, + "multiplyInteger-memory-arguments-slope": 1, + "nullList-cpu-arguments": 74433, + "nullList-memory-arguments": 32, + "quotientInteger-cpu-arguments-constant": 85848, + "quotientInteger-cpu-arguments-model-arguments-intercept": 228465, + "quotientInteger-cpu-arguments-model-arguments-slope": 122, + "quotientInteger-memory-arguments-intercept": 0, + "quotientInteger-memory-arguments-minimum": 1, + "quotientInteger-memory-arguments-slope": 1, + "remainderInteger-cpu-arguments-constant": 85848, + "remainderInteger-cpu-arguments-model-arguments-intercept": 228465, + "remainderInteger-cpu-arguments-model-arguments-slope": 122, + "remainderInteger-memory-arguments-intercept": 0, + "remainderInteger-memory-arguments-minimum": 1, + "remainderInteger-memory-arguments-slope": 1, + "serialiseData-cpu-arguments-intercept": 955506, + "serialiseData-cpu-arguments-slope": 213312, + "serialiseData-memory-arguments-intercept": 0, + "serialiseData-memory-arguments-slope": 2, + "sha2_256-cpu-arguments-intercept": 270652, + "sha2_256-cpu-arguments-slope": 22588, + "sha2_256-memory-arguments": 4, + "sha3_256-cpu-arguments-intercept": 1457325, + "sha3_256-cpu-arguments-slope": 64566, + "sha3_256-memory-arguments": 4, + "sliceByteString-cpu-arguments-intercept": 20467, + "sliceByteString-cpu-arguments-slope": 1, + "sliceByteString-memory-arguments-intercept": 4, + "sliceByteString-memory-arguments-slope": 0, + "sndPair-cpu-arguments": 141992, + "sndPair-memory-arguments": 32, + "subtractInteger-cpu-arguments-intercept": 100788, + "subtractInteger-cpu-arguments-slope": 420, + "subtractInteger-memory-arguments-intercept": 1, + "subtractInteger-memory-arguments-slope": 1, + "tailList-cpu-arguments": 81663, + "tailList-memory-arguments": 32, + "trace-cpu-arguments": 59498, + "trace-memory-arguments": 32, + "unBData-cpu-arguments": 20142, + "unBData-memory-arguments": 32, + "unConstrData-cpu-arguments": 24588, + "unConstrData-memory-arguments": 32, + "unIData-cpu-arguments": 20744, + "unIData-memory-arguments": 32, + "unListData-cpu-arguments": 25933, + "unListData-memory-arguments": 32, + "unMapData-cpu-arguments": 24623, + "unMapData-memory-arguments": 32, + "verifyEcdsaSecp256k1Signature-cpu-arguments": 43053543, + "verifyEcdsaSecp256k1Signature-memory-arguments": 10, + "verifyEd25519Signature-cpu-arguments-intercept": 53384111, + "verifyEd25519Signature-cpu-arguments-slope": 14333, + "verifyEd25519Signature-memory-arguments": 10, + "verifySchnorrSecp256k1Signature-cpu-arguments-intercept": 43574283, + "verifySchnorrSecp256k1Signature-cpu-arguments-slope": 26308, + "verifySchnorrSecp256k1Signature-memory-arguments": 10 + } + } +}; diff --git a/nix/workbench/profile/prof1-variants.jq b/nix/workbench/profile/prof1-variants.jq index 4904e409cfc..fb40169d90b 100644 --- a/nix/workbench/profile/prof1-variants.jq +++ b/nix/workbench/profile/prof1-variants.jq @@ -411,6 +411,10 @@ def all_profile_variants: ({} | .generator.tps = 0.4 ) as $double_tps_saturation_plutus + | + ({} + | .generator.tps = 0.45 + ) as $double_plus_tps_saturation_plutus | ($current_tps_saturation_plutus * { extra_desc: "with Plutus workload" @@ -480,6 +484,30 @@ def all_profile_variants: } | .generator.tx_fee = 1020000 ) as $plutus_loop_secp_schnorr + | + ({ generator: + { plutus: + { type: "LimitTxPerBlock_8" + , script: "HashOntoG2AndAdd" + , redeemer: + { "constructor": 0 + , "fields": [ + { "int": 1000000 } + ## ByteString content is arbitrary + , { "list": [ + { "bytes": "714805c6" } + , { "bytes": "c413111e" } + , { "bytes": "2d7eb870" } + , { "bytes": "4ecbd6a1" } + ] + } + ] + } + } + } + } + | .generator.tx_fee = 539076 + ) as $plutus_loop_blst ## ### Definition vocabulary: genesis variants ## @@ -498,6 +526,11 @@ def all_profile_variants: | .genesis.pparamsEpoch = timeline::lastKnownEpoch | .genesis.pparamsOverlays = ["v8-preview", "doublebudget"] ) as $costmodel_v8_preview_doubleb + | + ({} + | .genesis.pparamsEpoch = timeline::lastKnownEpoch + | .genesis.pparamsOverlays = ["v8-preview", "v9-preview"] + ) as $costmodel_v9_preview ## ### Definition vocabulary: node + tracer config variants ## @@ -957,6 +990,9 @@ def all_profile_variants: , $cibench_base * $plutus_base * $costmodel_v8_preview * $plutus_loop_secp_schnorr * { name: "ci-bench-plutus-secp-schnorr" } + , $cibench_base * $plutus_base * $double_plus_tps_saturation_plutus * $costmodel_v9_preview * $plutus_loop_blst * + { name: "ci-bench-plutusv3-blst" + } , $cibench_base * $without_tracer * { name: "ci-bench-notracer" } diff --git a/nix/workbench/profile/prof2-pparams.jq b/nix/workbench/profile/prof2-pparams.jq index da7fbbbf24a..f92baabfa26 100644 --- a/nix/workbench/profile/prof2-pparams.jq +++ b/nix/workbench/profile/prof2-pparams.jq @@ -4,6 +4,7 @@ import "epoch-timeline" as timeline; import "delta-blockbudget" as blockbudget; import "delta-v8-preview" as v8preview; +import "delta-v9-preview" as v9preview; def filterMapPParams(flt; map): timeline::epochs @@ -26,6 +27,7 @@ def overlays: { "doublebudget": blockbudget::delta_doublebudget , "stepshalf": blockbudget::delta_stepshalf , "v8-preview": v8preview::delta + , "v9-preview": v9preview::delta }; def pParamsWithOverlays(epoch; overlay_names): diff --git a/nix/workbench/service/tracing.nix b/nix/workbench/service/tracing.nix index 0965d160fb0..babffcd735e 100644 --- a/nix/workbench/service/tracing.nix +++ b/nix/workbench/service/tracing.nix @@ -88,6 +88,10 @@ let "TxSubmission.TxInbound".severity = "Debug"; "TxSubmission.TxOutbound".severity = "Notice"; "Version.NodeVersion".severity = "Info"; + + ## enable this to investigate tx validation errors, e.g. fee to small for Plutus script txns + ## comes with too much overhead to be the default for benchmarks + # "Mempool.RejectedTx".detail = "DDetailed"; }; }; From 10b134df41bacaca3cdcc642fc18434c1fd86d3a Mon Sep 17 00:00:00 2001 From: Michael Karg Date: Fri, 17 May 2024 09:47:01 +0200 Subject: [PATCH 07/21] script: apply to different arg; locli: capture workload --- bench/locli/src/Cardano/Report.hs | 6 +++++- .../Benchmarking/PlutusScripts/HashOntoG2AndAdd.hs | 11 +++++------ .../scripts-fallback/HashOntoG2AndAdd.plutus | 2 +- bench/tx-generator/test/ApiTest.hs | 13 +++++++++---- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/bench/locli/src/Cardano/Report.hs b/bench/locli/src/Cardano/Report.hs index af85568daa7..456795d2bc4 100644 --- a/bench/locli/src/Cardano/Report.hs +++ b/bench/locli/src/Cardano/Report.hs @@ -79,6 +79,7 @@ data Workload = WValue | WPlutusLoopCountdown | WPlutusLoopSECP + | WPlutusLoopBLST | WPlutusUnknown instance ToJSON Workload where @@ -86,12 +87,14 @@ instance ToJSON Workload where WValue -> "value-only" WPlutusLoopCountdown -> "Plutus countdown loop" WPlutusLoopSECP -> "Plutus SECP loop" + WPlutusLoopBLST -> "Plutus BLST loop" WPlutusUnknown -> "Plutus (other)" filenameInfix :: Workload -> Text filenameInfix = \case WPlutusLoopCountdown -> "plutus" WPlutusLoopSECP -> "plutus-secp" + WPlutusLoopBLST -> "plutus-blst" WValue -> "value-only" _ -> "unknown" @@ -143,9 +146,10 @@ liftTmplRun Summary{sumWorkload=generatorProfile case plutusLoopScript generatorProfile of Nothing -> WValue Just script - | script == "Loop" -> WPlutusLoopCountdown + | script `elem` ["Loop", "LoopV3"] -> WPlutusLoopCountdown | script == "EcdsaSecp256k1Loop" -> WPlutusLoopSECP | script == "SchnorrSecp256k1Loop" -> WPlutusLoopSECP + | script == "HashOntoG2AndAdd" -> WPlutusLoopBLST | otherwise -> WPlutusUnknown } diff --git a/bench/plutus-scripts-bench/src/Cardano/Benchmarking/PlutusScripts/HashOntoG2AndAdd.hs b/bench/plutus-scripts-bench/src/Cardano/Benchmarking/PlutusScripts/HashOntoG2AndAdd.hs index 787e7e769f0..300e381da0e 100644 --- a/bench/plutus-scripts-bench/src/Cardano/Benchmarking/PlutusScripts/HashOntoG2AndAdd.hs +++ b/bench/plutus-scripts-bench/src/Cardano/Benchmarking/PlutusScripts/HashOntoG2AndAdd.hs @@ -19,8 +19,8 @@ import qualified PlutusLedgerApi.V3 as PlutusV3 import Prelude as Haskell (String, (.), (<$>)) --- import Data.ByteString (ByteString) import qualified Data.ByteString.Short as SBS +import GHC.ByteOrder (ByteOrder(LittleEndian)) import Language.Haskell.TH import Language.Haskell.TH.Syntax @@ -35,7 +35,6 @@ scriptName script :: PlutusBenchScript script = mkPlutusBenchScript scriptName (toScriptInAnyLang (PlutusScript PlutusScriptV3 scriptSerialized)) - {-# INLINABLE mkValidator #-} mkValidator :: BuiltinData -> BuiltinData -> BuiltinData -> () mkValidator _datum red _txContext = @@ -46,14 +45,14 @@ mkValidator _datum red _txContext = then traceError "redeemer is < 1000000" else loop n l where - hashAndAddG2 :: [BuiltinByteString] -> BuiltinBLS12_381_G2_Element - hashAndAddG2 l = + hashAndAddG2 :: [BuiltinByteString] -> Integer -> BuiltinBLS12_381_G2_Element + hashAndAddG2 l i = go l (Tx.bls12_381_G2_uncompress Tx.bls12_381_G2_compressed_zero) where go [] !acc = acc - go (q:qs) !acc = go qs $ Tx.bls12_381_G2_add (Tx.bls12_381_G2_hashToGroup q emptyByteString) acc + go (q:qs) !acc = go qs $ Tx.bls12_381_G2_add (Tx.bls12_381_G2_hashToGroup q (integerToByteString LittleEndian 0 i)) acc loop i l | i == 1000000 = () - | otherwise = let !_ = hashAndAddG2 l in loop (pred i) l + | otherwise = let !_ = hashAndAddG2 l i in loop (pred i) l hashAndAddG2ShortBs :: SBS.ShortByteString hashAndAddG2ShortBs = PlutusV3.serialiseCompiledCode $$(PlutusTx.compile [|| mkValidator ||]) diff --git a/bench/tx-generator/scripts-fallback/HashOntoG2AndAdd.plutus b/bench/tx-generator/scripts-fallback/HashOntoG2AndAdd.plutus index af36e883c59..0dba7178888 100644 --- a/bench/tx-generator/scripts-fallback/HashOntoG2AndAdd.plutus +++ b/bench/tx-generator/scripts-fallback/HashOntoG2AndAdd.plutus @@ -1,5 +1,5 @@ { "type": "PlutusScriptV3", "description": "", - "cborHex": "59020959020601010032323232322225329333333006003225333573466e1d200000215933335573e00250022800c004d5d08014d5d1001100090c800c8964cccccc02c0088a0045002280114004004500290ac9999aab9f00228011191940040086ae88010d5d0801c00242b266666601a00245002280100614008a00521800c00400e002460048c009180111801060045002280114008a005219001912999ab9a33710004904044bd0980224811572656465656d6572206973203c20313030303030300013300a00200144c005240110696e76616c69642072656465656d657200119319ab9c0018001802111999aab9f0012800c0004b26666660086ae840088a0045002280114008a00200290ac98021aba200390c0060060050012300244ca00460066ae880090002222223333333574800c4646600e6aae74004d55cf0009baa00723005375600e460086eb001c8c00cdd6803918011bae00780018011112999ab9a3370e904044bd0010c0004c8cc010cdc0801a4004004660080026f09220160c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003001222590028800c884cc014004cdde99bc300248810000311918008009119801980100100081" + "cborHex": "59020e59020b010100323232322225329333333006003225333573466e1d200000215933335573e00250022800c004d5d08014d5d1001100090c800c8964cccccc02c0088a0045002280114004004500290ac9999aab9f00228011191940040086ae88010d5d0801c00242b266666601a00245002280100614008a00521800c00400e002460048c009180111801060045002280114008a005219001912999ab9a33710004904044bd0980224811572656465656d6572206973203c20313030303030300013300a00200144c005240110696e76616c69642072656465656d657200119319ab9c0018001801911999aab9f0012800c0004b26666660086ae840088a0045002280114008a00200290ac98021aba200390c0060060050012300244ca00460066ae880090002222223333333574800c4646600e6aae74004d55cf0009baa00723005375600e460086eb001c8c00cdd6803918011bae0078001800911912999ab9a3370e904044bd0018c0004c8cc014cdc080224004004660040026f09220160c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003003222590028800c884cc014004cdde99bc3002333792941200000600311918008009119801980100100081" } diff --git a/bench/tx-generator/test/ApiTest.hs b/bench/tx-generator/test/ApiTest.hs index 75f0b7a6e42..10139e28558 100644 --- a/bench/tx-generator/test/ApiTest.hs +++ b/bench/tx-generator/test/ApiTest.hs @@ -33,6 +33,7 @@ import Control.Exception (SomeException (..), try) import Control.Monad import Data.Aeson (FromJSON, eitherDecodeFileStrict') import Data.Aeson.Encode.Pretty +import Data.Bool import qualified Data.ByteString as BS (pack) import qualified Data.ByteString.Lazy.Char8 as BSL (ByteString, pack, putStrLn, writeFile) import Data.Either (rights) @@ -274,11 +275,15 @@ checkPlutusLoop _ _ readFileJson :: FromJSON a => FilePath -> ExceptT TxGenError IO a readFileJson f = handleIOExceptT (TxGenError . show) (eitherDecodeFileStrict' f) >>= firstExceptT TxGenError . hoistEither +-- resolve protocol parameters file from --param PARAM +-- 1. try to resolve to file +-- 2. try to resolve from data/ directory readProtocolParametersOrDie :: FilePath -> IO ProtocolParameters -readProtocolParametersOrDie filePath - = do - parametersFile <- getDataFileName filePath - either die pure =<< eitherDecodeFileStrict' parametersFile +readProtocolParametersOrDie filePath = + resolver >>= eitherDecodeFileStrict' >>= either die pure + where + resolver = + doesFileExist filePath >>= bool (getDataFileName $ "data" filePath) (pure filePath) resolveRedeemer :: Either ScriptData TxGenPlutusParams -> IO (Either TxGenError HashableScriptData) resolveRedeemer (Left hsd) = do From c9f3fe772290f2912e3a9820498baa1079c0710f Mon Sep 17 00:00:00 2001 From: Michael Karg Date: Fri, 17 May 2024 10:50:31 +0200 Subject: [PATCH 08/21] analysis: fine-tune block filtering --- .../analyse/chain-filters/size-moderate-2.json | 13 +++++++++++++ nix/workbench/profile/prof1-variants.jq | 10 +++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 nix/workbench/analyse/chain-filters/size-moderate-2.json diff --git a/nix/workbench/analyse/chain-filters/size-moderate-2.json b/nix/workbench/analyse/chain-filters/size-moderate-2.json new file mode 100644 index 00000000000..8c47cb4c79b --- /dev/null +++ b/nix/workbench/analyse/chain-filters/size-moderate-2.json @@ -0,0 +1,13 @@ +[ { "tag": "CBlock" + , "contents": + { "tag": "BFullnessGEq" + , "contents": 0.08 + } + } +, { "tag": "CBlock" + , "contents": + { "tag": "BFullnessLEq" + , "contents": 0.105 + } + } +] diff --git a/nix/workbench/profile/prof1-variants.jq b/nix/workbench/profile/prof1-variants.jq index fb40169d90b..30ddbb562b3 100644 --- a/nix/workbench/profile/prof1-variants.jq +++ b/nix/workbench/profile/prof1-variants.jq @@ -381,8 +381,8 @@ def all_profile_variants: ) as $for_15blk | ({} - | .node.shutdown_on_block_synced = 30 - ) as $for_30blk + | .node.shutdown_on_block_synced = 36 + ) as $for_36blk | ({} | .node.shutdown_on_slot_synced = 900 @@ -413,7 +413,7 @@ def all_profile_variants: ) as $double_tps_saturation_plutus | ({} - | .generator.tps = 0.45 + | .generator.tps = 0.48 ) as $double_plus_tps_saturation_plutus | ($current_tps_saturation_plutus * @@ -992,6 +992,10 @@ def all_profile_variants: } , $cibench_base * $plutus_base * $double_plus_tps_saturation_plutus * $costmodel_v9_preview * $plutus_loop_blst * { name: "ci-bench-plutusv3-blst" + , genesis: + { max_block_size: 88000 } + , analysis: + { filters: ["size-moderate-2"] } } , $cibench_base * $without_tracer * { name: "ci-bench-notracer" From 2951daa10d483809908012cb59606aef4b7481c1 Mon Sep 17 00:00:00 2001 From: Michael Karg Date: Fri, 17 May 2024 14:38:01 +0200 Subject: [PATCH 09/21] wb | genesis: fix --force flag and overwriting existing links --- nix/workbench/genesis/genesis.sh | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/nix/workbench/genesis/genesis.sh b/nix/workbench/genesis/genesis.sh index 3db398944f2..8bb52d4a014 100644 --- a/nix/workbench/genesis/genesis.sh +++ b/nix/workbench/genesis/genesis.sh @@ -40,12 +40,7 @@ case "$op" in prepare-cache-entry ) local usage="USAGE: wb genesis $op [--force] PROFILE-JSON NODE-SPECS OUTDIR CACHEDIR" - local profile_json=${1:-$WB_SHELL_PROFILE_DATA/profile.json} - local node_specs=${2:-$WB_SHELL_PROFILE_DATA/node-specs.json} - local cacheDir=${3:-$(envjqr 'cacheDir')} - local regenesis_causes=() - while test $# -gt 0; do case "$1" in --force ) @@ -58,6 +53,10 @@ case "$op" in shift done + local profile_json=${1:-$WB_SHELL_PROFILE_DATA/profile.json} + local node_specs=${2:-$WB_SHELL_PROFILE_DATA/node-specs.json} + local cacheDir=${3:-$(envjqr 'cacheDir')} + local cache_key_input cache_key cache_path mkdir -p "$cacheDir" @@ -661,12 +660,12 @@ genesis-create-testnet-data() { jq_fmutate "$dir/conway-genesis.spec.json" -S . jq_fmutate "$dir/conway-genesis.json" -S . - ln -s shelley-genesis.spec.json "$dir/genesis-shelley.spec.json" - ln -s shelley-genesis.json "$dir/genesis-shelley.json" - ln -s alonzo-genesis.spec.json "$dir/genesis.alonzo.spec.json" - ln -s alonzo-genesis.json "$dir/genesis.alonzo.json" - ln -s conway-genesis.spec.json "$dir/genesis.conway.spec.json" - ln -s conway-genesis.json "$dir/genesis.conway.json" + ln -sf shelley-genesis.spec.json "$dir/genesis-shelley.spec.json" + ln -sf shelley-genesis.json "$dir/genesis-shelley.json" + ln -sf alonzo-genesis.spec.json "$dir/genesis.alonzo.spec.json" + ln -sf alonzo-genesis.json "$dir/genesis.alonzo.json" + ln -sf conway-genesis.spec.json "$dir/genesis.conway.spec.json" + ln -sf conway-genesis.json "$dir/genesis.conway.json" shopt -s extglob @@ -681,7 +680,7 @@ genesis-create-testnet-data() { local no=${elems[1]##*([[:alpha:]])} local keyname=${elems[2]%.*} local keyext=${elems[2]##*.} - ln -s "../${path}" "$dir/${to}/${keyname}${no}.${keyext}" + ln -sf "../${path}" "$dir/${to}/${keyname}${no}.${keyext}" done } From 2b4cbc25cfcbde9cd1644d6865468e7bb03ca55e Mon Sep 17 00:00:00 2001 From: Michael Karg Date: Fri, 17 May 2024 15:35:32 +0200 Subject: [PATCH 10/21] wb | profiles: add plutusV3CostModel as overlay to Conway genesis --- .../profile/pparams/delta-v9-preview.jq | 238 ++++++++++++++++++ nix/workbench/profile/profiles.jq | 1 + 2 files changed, 239 insertions(+) diff --git a/nix/workbench/profile/pparams/delta-v9-preview.jq b/nix/workbench/profile/pparams/delta-v9-preview.jq index 3a6138a9ebf..d123848b4f4 100644 --- a/nix/workbench/profile/pparams/delta-v9-preview.jq +++ b/nix/workbench/profile/pparams/delta-v9-preview.jq @@ -246,5 +246,243 @@ def delta: "verifySchnorrSecp256k1Signature-cpu-arguments-slope": 26308, "verifySchnorrSecp256k1Signature-memory-arguments": 10 } + }, + "conway": { + "plutusV3CostModel": + [ + 100788, + 420, + 1, + 1, + 1000, + 173, + 0, + 1, + 1000, + 59957, + 4, + 1, + 11183, + 32, + 201305, + 8356, + 4, + 16000, + 100, + 16000, + 100, + 16000, + 100, + 16000, + 100, + 16000, + 100, + 16000, + 100, + 100, + 100, + 16000, + 100, + 94375, + 32, + 132994, + 32, + 61462, + 4, + 72010, + 178, + 0, + 1, + 22151, + 32, + 91189, + 769, + 4, + 2, + 85848, + 228465, + 122, + 0, + 1, + 1, + 1000, + 42921, + 4, + 2, + 24548, + 29498, + 38, + 1, + 898148, + 27279, + 1, + 51775, + 558, + 1, + 39184, + 1000, + 60594, + 1, + 141895, + 32, + 83150, + 32, + 15299, + 32, + 76049, + 1, + 13169, + 4, + 22100, + 10, + 28999, + 74, + 1, + 28999, + 74, + 1, + 43285, + 552, + 1, + 44749, + 541, + 1, + 33852, + 32, + 68246, + 32, + 72362, + 32, + 7243, + 32, + 7391, + 32, + 11546, + 32, + 85848, + 228465, + 122, + 0, + 1, + 1, + 90434, + 519, + 0, + 1, + 74433, + 32, + 85848, + 228465, + 122, + 0, + 1, + 1, + 85848, + 228465, + 122, + 0, + 1, + 1, + 955506, + 213312, + 0, + 2, + 270652, + 22588, + 4, + 1457325, + 64566, + 4, + 20467, + 1, + 4, + 0, + 141992, + 32, + 100788, + 420, + 1, + 1, + 81663, + 32, + 59498, + 32, + 20142, + 32, + 24588, + 32, + 20744, + 32, + 25933, + 32, + 24623, + 32, + 43053543, + 10, + 53384111, + 14333, + 10, + 43574283, + 26308, + 10, + 16000, + 100, + 16000, + 100, + 962335, + 18, + 2780678, + 6, + 442008, + 1, + 52538055, + 3756, + 18, + 267929, + 18, + 76433006, + 8868, + 18, + 52948122, + 18, + 1995836, + 36, + 3227919, + 12, + 901022, + 1, + 166917843, + 4307, + 36, + 284546, + 36, + 158221314, + 26549, + 36, + 74698472, + 36, + 333849714, + 1, + 254006273, + 72, + 2174038, + 72, + 2261318, + 64571, + 4, + 207616, + 8310, + 4, + 1293828, + 28716, + 63, + 0, + 1, + 1006041, + 43623, + 251, + 0, + 1 + ] } }; diff --git a/nix/workbench/profile/profiles.jq b/nix/workbench/profile/profiles.jq index 026228f739d..1ac3ed1b55b 100644 --- a/nix/workbench/profile/profiles.jq +++ b/nix/workbench/profile/profiles.jq @@ -111,6 +111,7 @@ def generate_all_era_profiles($era; $mcompo; $topo): | .genesis.shelley.protocolParams = $pparams.shelley | .genesis.alonzo = $pparams.alonzo | .genesis.alonzo.costModels = $pparams.costModels + | .genesis.conway = $pparams.conway ## Profiles define their own cluster composition: | . * { composition: (.composition // $default_compo) } From b4296ed7d92582f6a99ed2a1158fec241ef0572d Mon Sep 17 00:00:00 2001 From: Michael Karg Date: Tue, 21 May 2024 18:16:33 +0200 Subject: [PATCH 11/21] wb | tracing: silence some UTxO-HD specific trace msgs --- nix/workbench/service/tracing.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/nix/workbench/service/tracing.nix b/nix/workbench/service/tracing.nix index babffcd735e..9b8ef772d6e 100644 --- a/nix/workbench/service/tracing.nix +++ b/nix/workbench/service/tracing.nix @@ -89,6 +89,17 @@ let "TxSubmission.TxOutbound".severity = "Notice"; "Version.NodeVersion".severity = "Info"; + ## These messages are UTxO-HD specific. On a regular node, the tracing system might warn at startup about config incosistencies (as those tracers do not exist). + ## This warning is expected, and can be safely ignored. + ## Silencing the tracers below aims at having a comparable log line rates (msgs per second) on UTxO-HD and regular nodes. + "ChainDB.LedgerEvent.Forker".severity = "Silence"; + "Mempool.MempoolAttemptAdd".severity = "Silence"; + "Mempool.MempoolAttemptingSync".severity = "Silence"; + "Mempool.MempoolLedgerFound".severity = "Silence"; + "Mempool.MempoolLedgerNotFound".severity = "Silence"; + "Mempool.MempoolSyncDone".severity = "Silence"; + "Mempool.MempoolSyncNotNeeded".severity = "Silence"; + ## enable this to investigate tx validation errors, e.g. fee to small for Plutus script txns ## comes with too much overhead to be the default for benchmarks # "Mempool.RejectedTx".detail = "DDetailed"; From d4f524d253f1ca9120eecf5604f41310027a1c61 Mon Sep 17 00:00:00 2001 From: Michael Karg Date: Tue, 21 May 2024 22:20:45 +0200 Subject: [PATCH 12/21] tx-generator: fix data-files --- bench/tx-generator/data/run-script.json | 32 ------------------------- bench/tx-generator/tx-generator.cabal | 6 +---- 2 files changed, 1 insertion(+), 37 deletions(-) delete mode 100644 bench/tx-generator/data/run-script.json diff --git a/bench/tx-generator/data/run-script.json b/bench/tx-generator/data/run-script.json deleted file mode 100644 index e63421f5ef3..00000000000 --- a/bench/tx-generator/data/run-script.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "add_tx_size": 100, - "debugMode": false, - "era": "Conway", - "init_cooldown": 5, - "inputs_per_tx": 2, - "localNodeSocketPath": "../node-0/node.socket", - "min_utxo_value": 10000000, - "nodeConfigFile": "../node-0/config.json", - "outputs_per_tx": 2, - "plutus": { - "type": "LimitSaturationLoop", - "script": { - "Left": "LoopV3" - } - }, - "sigKey": "../genesis/utxo-keys/utxo1.skey", - "targetNodes": [ - { - "addr": "127.0.0.1", - "port": 30000 - }, - { - "addr": "127.0.0.1", - "port": 30001 - } - ], - "tps": 15, - "tx_count": 9000, - "tx_fee": 1000000, - "pools": [] -} diff --git a/bench/tx-generator/tx-generator.cabal b/bench/tx-generator/tx-generator.cabal index 68279289cb3..db4f7421f87 100644 --- a/bench/tx-generator/tx-generator.cabal +++ b/bench/tx-generator/tx-generator.cabal @@ -14,11 +14,7 @@ license-files: LICENSE NOTICE build-type: Simple extra-source-files: README.md -data-files: data/protocol-parameters.json - data/protocol-parameters-v8.json - data/loop.redeemer.json - data/ecdsa-secp256k1-loop.redeemer.json - data/schnorr-secp256k1-loop.redeemer.json +data-files: data/*.json scripts-fallback/*.plutus common project-config From fb75d3a363a6b148119c0abd98c0dab0ead26de2 Mon Sep 17 00:00:00 2001 From: Michael Karg Date: Wed, 22 May 2024 12:02:58 +0200 Subject: [PATCH 13/21] tx-generator: fail early on ScriptData parse error --- .../src/Cardano/Benchmarking/Command.hs | 43 ++++++++++++++----- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/bench/tx-generator/src/Cardano/Benchmarking/Command.hs b/bench/tx-generator/src/Cardano/Benchmarking/Command.hs index f0b13c7c5c4..ffc9ab8fa6c 100644 --- a/bench/tx-generator/src/Cardano/Benchmarking/Command.hs +++ b/bench/tx-generator/src/Cardano/Benchmarking/Command.hs @@ -1,6 +1,8 @@ {-# LANGUAGE GADTs #-} {-# LANGUAGE LambdaCase #-} +{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE ScopedTypeVariables #-} + {-# OPTIONS_GHC -Wno-all-missed-specialisations -Wno-orphans #-} module Cardano.Benchmarking.Command @@ -10,22 +12,25 @@ module Cardano.Benchmarking.Command ) where -import Prelude -import System.Exit - -import Data.Aeson (fromJSON) -import Data.ByteString.Lazy as BSL -import Data.Text.IO as T -import Options.Applicative as Opt - -import Ouroboros.Network.NodeToClient (withIOManager) - import Cardano.Benchmarking.Compiler (compileOptions) import Cardano.Benchmarking.Script (parseScriptFileAeson, runScript) import Cardano.Benchmarking.Script.Aeson (parseJSONFile, prettyPrint) import Cardano.Benchmarking.Script.Selftest (runSelftest) import Cardano.Benchmarking.Version as Version +import Cardano.TxGenerator.PlutusContext (readScriptData) import Cardano.TxGenerator.Setup.NixService +import Cardano.TxGenerator.Types (TxGenPlutusParams (..)) +import Ouroboros.Network.NodeToClient (withIOManager) + +import Prelude + +import Data.Aeson (fromJSON) +import Data.ByteString.Lazy as BSL +import Data.Foldable (for_) +import Data.Maybe (catMaybes) +import Data.Text.IO as T +import Options.Applicative as Opt +import System.Exit data Command @@ -52,6 +57,8 @@ runCommand = withIOManager $ \iocp -> do "--> initial options:\n" ++ show opts ++ "\n--> final options:\n" ++ show finalOpts + quickTestPlutusDataOrDie finalOpts + case compileOptions finalOpts of Right script -> runScript script iocp >>= handleError err -> handleError err @@ -78,6 +85,22 @@ runCommand = withIOManager $ \iocp -> do mangleTracerConfig traceSocket opts = opts { _nix_cardanoTracerSocket = traceSocket <> _nix_cardanoTracerSocket opts} +-- if there's a parsing error wrt. ScriptData, we want to fail early, before the splitting phase +quickTestPlutusDataOrDie :: NixServiceOptions -> IO () +quickTestPlutusDataOrDie NixServiceOptions{_nix_plutus} = do + for_ files test + Prelude.putStrLn $ + "--> success: quickTestPlutusDataOrDie " ++ show files + where + test file = + readScriptData file >>= \case + Left err -> die $ "quickTestPlutusDataOrDie (" ++ file ++ "): " ++ show err + Right{} -> pure () + + files = case _nix_plutus of + Just PlutusOn{plutusDatum, plutusRedeemer} -> catMaybes [plutusDatum, plutusRedeemer] + _ -> [] + commandParser :: Parser Command commandParser = subparser ( From 3fb83893f712b2164a4cd59f4839c93f45d9420b Mon Sep 17 00:00:00 2001 From: Michael Karg Date: Tue, 21 May 2024 22:31:26 +0200 Subject: [PATCH 14/21] wb | profiles: PlutusV3 nomadcloud; DRep100k; cleanups --- Makefile | 5 ++- nix/workbench/profile/prof1-variants.jq | 53 ++++++++++++++++++++++--- 2 files changed, 51 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index f051be4d99f..a11453861ef 100644 --- a/Makefile +++ b/Makefile @@ -99,8 +99,9 @@ PROFILES_VENDOR := dish dish-plutus dish-10M dish-10M-plutus # Not all local profiles are compatible or tested (yet) with a cloud runs PROFILES_NOMAD_PERF := default-nomadperf ci-test-nomadperf ci-bench-nomadperf value-nomadperf oldtracing-nomadperf ci-test-oldtracing-nomadperf ci-bench-oldtracing-nomadperf value-oldtracing-nomadperf PROFILES_NOMAD_PERF += plutus-nomadperf fast-nomadperf latency-nomadperf -PROFILES_NOMAD_PERF_DREP := value-drep1k-nomadperf value-drep2k-nomadperf value-drep10k-nomadperf -PROFILES_NOMAD_PERF_DREP += plutus-drep1k-nomadperf plutus-drep2k-nomadperf plutus-drep10k-nomadperf +PROFILES_NOMAD_PERF += plutusv3-blst-nomadperf plutusv3-blst-half-nomadperf plutusv3-blst-double-nomadperf +PROFILES_NOMAD_PERF_DREP := value-drep1k-nomadperf value-drep2k-nomadperf value-drep10k-nomadperf value-drep100k-nomadperf +PROFILES_NOMAD_PERF_DREP += plutus-drep1k-nomadperf plutus-drep2k-nomadperf plutus-drep10k-nomadperf plutus-drep100k-nomadperf PROFILES_NOMAD_PERF_NOP2P := default-nomadperf-nop2p oldtracing-nomadperf-nop2p ci-test-nomadperf-nop2p ci-bench-nomadperf-nop2p PROFILES_NOMAD_PERF_NOP2P += value-nomadperf-nop2p value-oldtracing-nomadperf-nop2p plutus-nomadperf-nop2p fast-nomadperf-nop2p PROFILES_NOMAD_PERFSSD := value-nomadperfssd fast-nomadperfssd latency-nomadperfssd diff --git a/nix/workbench/profile/prof1-variants.jq b/nix/workbench/profile/prof1-variants.jq index 30ddbb562b3..ebbacb4f17c 100644 --- a/nix/workbench/profile/prof1-variants.jq +++ b/nix/workbench/profile/prof1-variants.jq @@ -104,6 +104,10 @@ def all_profile_variants: { dreps: 10000 } } as $dreps_large + | { genesis: + { dreps: 100000 + } + } as $dreps_enormous ## ### Definition vocabulary: chain ## @@ -518,19 +522,25 @@ def all_profile_variants: ) as $costmodel_v8_preview | ({} - | .genesis.pparamsEpoch = timeline::lastKnownEpoch | .genesis.pparamsOverlays = ["v8-preview", "stepshalf"] ) as $costmodel_v8_preview_stepshalf | ({} - | .genesis.pparamsEpoch = timeline::lastKnownEpoch | .genesis.pparamsOverlays = ["v8-preview", "doublebudget"] ) as $costmodel_v8_preview_doubleb | ({} | .genesis.pparamsEpoch = timeline::lastKnownEpoch | .genesis.pparamsOverlays = ["v8-preview", "v9-preview"] - ) as $costmodel_v9_preview + ) as $costmodel_v9_preview + | + ({} + | .genesis.pparamsOverlays = ["v8-preview", "v9-preview", "stepshalf"] + ) as $costmodel_v9_preview_stepshalf + | + ({} + | .genesis.pparamsOverlays = ["v8-preview", "v9-preview", "doublebudget"] + ) as $costmodel_v9_preview_doubleb ## ### Definition vocabulary: node + tracer config variants ## @@ -715,7 +725,7 @@ def all_profile_variants: , desc: "AWS c5-2xlarge cluster dataset, 7 epochs" }) as $nomad_perfssd_base | - ($scenario_nomad_perf * $compose_fiftytwo * $dataset_oct2021 * $for_9ep * $plutus_base * $plutus_loop_counter * + ($scenario_nomad_perf * $compose_fiftytwo * $dataset_oct2021 * $for_9ep * $plutus_base * { node: { shutdown_on_slot_synced: 72000 } @@ -731,7 +741,19 @@ def all_profile_variants: , max_block_size: 88000 } , desc: "AWS c5-2xlarge cluster dataset, 9 epochs" - }) as $nomad_perf_plutus_base + }) as $nomad_perf_plutus_common_base + | + ($nomad_perf_plutus_common_base * $plutus_loop_counter + ) as $nomad_perf_plutus_base + | + ($nomad_perf_plutus_common_base * $plutus_loop_blst * + { analysis: + { filters: ["epoch3+", "size-moderate-2"] + } + , generator: + { tps: 2.0 + } + }) as $nomad_perf_plutusv3blst_base | ($scenario_latency * $compose_fiftytwo * $dataset_empty * $no_filtering * { desc: "AWS perf class cluster, stop when all latency services stop" @@ -850,6 +872,10 @@ def all_profile_variants: ($nomad_perf_plutus_base * $nomad_perf_dense * $p2p * $costmodel_v8_preview ) as $plutus_nomadperf_template | + # P&T Nomad cluster: 52 nodes, P2P by default - PlutusV3 BLST workload + ($nomad_perf_plutusv3blst_base * $nomad_perf_dense * $p2p * $costmodel_v9_preview + ) as $plutusv3blst_nomadperf_template + | ### First, auto-named profiles: ### @@ -1105,6 +1131,17 @@ def all_profile_variants: { name: "latency-nomadperfssd" } +## P&T Nomad cluster: 52 nodes, PlutusV3 BLST workloads + , $plutusv3blst_nomadperf_template * + { name: "plutusv3-blst-nomadperf" + } + , $plutusv3blst_nomadperf_template * $costmodel_v9_preview_stepshalf * + { name: "plutusv3-blst-half-nomadperf" + } + , $plutusv3blst_nomadperf_template * $costmodel_v9_preview_doubleb * + { name: "plutusv3-blst-double-nomadperf" + } + ## P&T Nomad cluster: 52 nodes, value-only and Plutus workloads - DRep injection variants , $value_nomadperf_template * $dreps_small * { name: "value-drep1k-nomadperf" @@ -1115,6 +1152,9 @@ def all_profile_variants: , $value_nomadperf_template * $dreps_large * { name: "value-drep10k-nomadperf" } + , $value_nomadperf_template * $dreps_enormous * + { name: "value-drep100k-nomadperf" + } , $plutus_nomadperf_template * $dreps_small * { name: "plutus-drep1k-nomadperf" } @@ -1124,6 +1164,9 @@ def all_profile_variants: , $plutus_nomadperf_template * $dreps_large * { name: "plutus-drep10k-nomadperf" } + , $plutus_nomadperf_template * $dreps_enormous * + { name: "plutus-drep100k-nomadperf" + } ## P&T Nomad cluster: 52 nodes, 3 regions, value-only (with old tracing variant) and Plutus, no P2P flavour , $nomad_perf_base * $nomad_perf_dense * $costmodel_v8_preview * From 4c62e9801ac8b99dbc79b2d81a22118d68f97dbb Mon Sep 17 00:00:00 2001 From: Michael Karg Date: Thu, 23 May 2024 09:20:29 +0200 Subject: [PATCH 15/21] tx-generator: fix fields now mandatory in test data; bump dep constraint --- bench/tx-generator/data/protocol-parameters-conway.json | 4 ++-- bench/tx-generator/data/protocol-parameters-v8.json | 4 ++-- bench/tx-generator/data/protocol-parameters.json | 4 ++-- bench/tx-generator/test/ApiTest.hs | 2 ++ bench/tx-generator/tx-generator.cabal | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/bench/tx-generator/data/protocol-parameters-conway.json b/bench/tx-generator/data/protocol-parameters-conway.json index e35b09ea46f..03d5b2c06d6 100644 --- a/bench/tx-generator/data/protocol-parameters-conway.json +++ b/bench/tx-generator/data/protocol-parameters-conway.json @@ -582,7 +582,7 @@ "verifySchnorrSecp256k1Signature-memory-arguments": 10 } }, - "decentralization": null, + "decentralization": 0, "executionUnitPrices": { "priceMemory": 0.0577, "priceSteps": 7.21e-05 @@ -602,7 +602,7 @@ "maxTxSize": 16384, "maxValueSize": 5000, "minPoolCost": 340000000, - "minUTxOValue": null, + "minUTxOValue": 4310, "monetaryExpansion": 0.003, "poolPledgeInfluence": 0.3, "poolRetireMaxEpoch": 18, diff --git a/bench/tx-generator/data/protocol-parameters-v8.json b/bench/tx-generator/data/protocol-parameters-v8.json index c6e563e7fed..e66f0a6e6b7 100644 --- a/bench/tx-generator/data/protocol-parameters-v8.json +++ b/bench/tx-generator/data/protocol-parameters-v8.json @@ -347,7 +347,7 @@ 10 ] }, - "decentralization": null, + "decentralization": 0, "executionUnitPrices": { "priceMemory": 0.0577, "priceSteps": 7.21e-05 @@ -367,7 +367,7 @@ "maxTxSize": 16384, "maxValueSize": 5000, "minPoolCost": 340000000, - "minUTxOValue": null, + "minUTxOValue": 4310, "monetaryExpansion": 0.003, "poolPledgeInfluence": 0.3, "poolRetireMaxEpoch": 18, diff --git a/bench/tx-generator/data/protocol-parameters.json b/bench/tx-generator/data/protocol-parameters.json index e4e63ab3d20..916964e2057 100644 --- a/bench/tx-generator/data/protocol-parameters.json +++ b/bench/tx-generator/data/protocol-parameters.json @@ -170,7 +170,7 @@ 1 ] }, - "decentralization": null, + "decentralization": 0, "executionUnitPrices": { "priceMemory": 0.0577, "priceSteps": 7.21e-05 @@ -190,7 +190,7 @@ "maxTxSize": 16384, "maxValueSize": 5000, "minPoolCost": 340000000, - "minUTxOValue": null, + "minUTxOValue": 4310, "monetaryExpansion": 0.003, "poolPledgeInfluence": 0.3, "poolRetireMaxEpoch": 18, diff --git a/bench/tx-generator/test/ApiTest.hs b/bench/tx-generator/test/ApiTest.hs index 10139e28558..48b8a5d999e 100644 --- a/bench/tx-generator/test/ApiTest.hs +++ b/bench/tx-generator/test/ApiTest.hs @@ -16,8 +16,10 @@ import Cardano.Api import qualified Cardano.Api.Ledger as Api import Cardano.Api.Shelley (ProtocolParameters (..), fromPlutusData) +#ifdef WITH_LIBRARY import Cardano.Benchmarking.PlutusScripts import Cardano.Benchmarking.PlutusScripts.CustomCallTypes +#endif import Cardano.Node.Configuration.POM (NodeConfiguration (..)) import Cardano.Node.Protocol.Types import Cardano.Node.Types (AdjustFilePaths (..), GenesisFile (..)) diff --git a/bench/tx-generator/tx-generator.cabal b/bench/tx-generator/tx-generator.cabal index db4f7421f87..a37233566d0 100644 --- a/bench/tx-generator/tx-generator.cabal +++ b/bench/tx-generator/tx-generator.cabal @@ -26,7 +26,7 @@ common with-library -- It makes sure, we only depend on that package if it is buildable. -- The tx-generator will fall back to pre-serialized Plutus scripts if this package is not present. if !(impl(ghc <9.6) || impl(ghc >=9.7)) - build-depends: plutus-scripts-bench ^>= 1.0.2 + build-depends: plutus-scripts-bench ^>= 1.0.3 cpp-options: -DWITH_LIBRARY library From 3409648b9a6c8c138e8a0e8fc1fe1e7d7b40be81 Mon Sep 17 00:00:00 2001 From: Michael Karg Date: Thu, 23 May 2024 14:46:01 +0200 Subject: [PATCH 16/21] bench: generous fee to operate with larger block budgets --- nix/workbench/profile/prof1-variants.jq | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/workbench/profile/prof1-variants.jq b/nix/workbench/profile/prof1-variants.jq index ebbacb4f17c..ff4ce2d76a6 100644 --- a/nix/workbench/profile/prof1-variants.jq +++ b/nix/workbench/profile/prof1-variants.jq @@ -510,7 +510,7 @@ def all_profile_variants: } } } - | .generator.tx_fee = 539076 + | .generator.tx_fee = 935000 ) as $plutus_loop_blst ## ### Definition vocabulary: genesis variants From b6b122b794fa6108a1cffe113af65cc0db779193 Mon Sep 17 00:00:00 2001 From: Michael Karg Date: Fri, 24 May 2024 18:46:25 +0200 Subject: [PATCH 17/21] tx-generator: allow fallback scripts even with library --- .../src/Cardano/TxGenerator/Setup/Plutus.hs | 29 +++++++++---------- bench/tx-generator/test/ApiTest.hs | 2 +- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/bench/tx-generator/src/Cardano/TxGenerator/Setup/Plutus.hs b/bench/tx-generator/src/Cardano/TxGenerator/Setup/Plutus.hs index b32e4688ee8..a101c3c7688 100644 --- a/bench/tx-generator/src/Cardano/TxGenerator/Setup/Plutus.hs +++ b/bench/tx-generator/src/Cardano/TxGenerator/Setup/Plutus.hs @@ -36,16 +36,22 @@ import qualified PlutusLedgerApi.V3 as PlutusV3 import qualified PlutusTx.AssocMap as AssocMap (empty) import Cardano.TxGenerator.Types (TxGenError (..)) - #ifdef WITH_LIBRARY import Cardano.Benchmarking.PlutusScripts (findPlutusScript) -#else +#endif import Control.Exception (SomeException (..), try) import Paths_tx_generator -#endif type ProtocolVersion = (Int, Int) + +resolveFromLibrary :: String -> Maybe ScriptInAnyLang +#ifdef WITH_LIBRARY +resolveFromLibrary = findPlutusScript +#else +resolveFromLibrary = const Nothing +#endif + -- | 'readPlutusScript' accepts a string for the name of a script that -- may be known in the 'Left' case and a filepath to read as a script -- in the 'Right' case. API errors are signalled via an 'Either'. @@ -53,19 +59,12 @@ type ProtocolVersion = (Int, Int) -- defined (via TH) scripts for the script name lookups instead of a -- set of library files. readPlutusScript :: Either String FilePath -> IO (Either TxGenError ScriptInAnyLang) -#ifdef WITH_LIBRARY readPlutusScript (Left s) - = pure - $ maybe (Left . TxGenError $ "readPlutusScript: " ++ s ++ " not found.") - Right - (findPlutusScript s) -#else -readPlutusScript (Left s) - = try (getDataFileName $ "scripts-fallback/" ++ s ++ ".plutus") >>= either - (\(SomeException e) -> pure $ Left $ TxGenError $ show e) - (readPlutusScript . Right) -#endif - + = case resolveFromLibrary s of + Just s' -> pure $ Right s' + Nothing -> try (getDataFileName $ "scripts-fallback/" ++ s ++ ".plutus") >>= either + (\(SomeException e) -> pure $ Left $ TxGenError $ show e) + (readPlutusScript . Right) readPlutusScript (Right fp) = runExceptT $ do script <- firstExceptT ApiError $ diff --git a/bench/tx-generator/test/ApiTest.hs b/bench/tx-generator/test/ApiTest.hs index 48b8a5d999e..34d0108dfc5 100644 --- a/bench/tx-generator/test/ApiTest.hs +++ b/bench/tx-generator/test/ApiTest.hs @@ -348,7 +348,7 @@ parserCommandLine <> metavar "PARAM" <> help "Path to protocol parameter file" <> completer (bashCompleter "file") - <> value "data/protocol-parameters-v8.json" + <> value "protocol-parameters-v8.json" ) parseRunPath = strOption ( long "run" From 655c2893be91d63dfef15ac2cacb0085898568b4 Mon Sep 17 00:00:00 2001 From: Michael Karg Date: Mon, 27 May 2024 09:41:55 +0200 Subject: [PATCH 18/21] wb: new 2024 bytecode for plutus loop script --- Makefile | 4 ++-- .../plutus-scripts-bench.cabal | 2 +- .../src/Cardano/Benchmarking/PlutusScripts.hs | 4 ++-- .../PlutusScripts/{Loop.hs => Loop2024.hs} | 2 +- bench/tx-generator/data/Loop2024.redeemer.json | 3 +++ .../scripts-fallback/Loop2024.plutus | 5 +++++ nix/workbench/profile/prof1-variants.jq | 16 ++++++++++++++++ 7 files changed, 30 insertions(+), 6 deletions(-) rename bench/plutus-scripts-bench/src/Cardano/Benchmarking/PlutusScripts/{Loop.hs => Loop2024.hs} (96%) create mode 100644 bench/tx-generator/data/Loop2024.redeemer.json create mode 100644 bench/tx-generator/scripts-fallback/Loop2024.plutus diff --git a/Makefile b/Makefile index a11453861ef..6f11a5724d1 100644 --- a/Makefile +++ b/Makefile @@ -78,7 +78,7 @@ PROFILES_BASE := default default-p2p plutus plutus-secp-ecdsa plutus PROFILES_FAST := fast fast-p2p fast-plutus fast-notracer fast-oldtracing faststartup-24M PROFILES_CI_TEST := ci-test ci-test-p2p ci-test-plutus ci-test-notracer ci-test-rtview ci-test-dense10 PROFILES_CI_BENCH := ci-bench ci-bench-p2p ci-bench-plutus ci-bench-plutus-secp-ecdsa ci-bench-plutus-secp-schnorr ci-bench-notracer ci-bench-rtview ci-bench-lmdb ci-bench-drep -PROFILES_CI_BENCH += ci-bench-plutusv3-blst +PROFILES_CI_BENCH += ci-bench-plutusv3-blst ci-bench-plutus24 PROFILES_TRACE_BENCH := trace-bench trace-bench-notracer trace-bench-oldtracing trace-bench-rtview PROFILES_TRACE_FULL := trace-full trace-full-rtview PROFILES_EPOCHTRANS := epoch-transition @@ -98,7 +98,7 @@ PROFILES_VENDOR := dish dish-plutus dish-10M dish-10M-plutus # Cloud version of "default", "ci-test" and "ci-bench" plus value (52+explorer) # Not all local profiles are compatible or tested (yet) with a cloud runs PROFILES_NOMAD_PERF := default-nomadperf ci-test-nomadperf ci-bench-nomadperf value-nomadperf oldtracing-nomadperf ci-test-oldtracing-nomadperf ci-bench-oldtracing-nomadperf value-oldtracing-nomadperf -PROFILES_NOMAD_PERF += plutus-nomadperf fast-nomadperf latency-nomadperf +PROFILES_NOMAD_PERF += plutus-nomadperf plutus24-nomadperf fast-nomadperf latency-nomadperf PROFILES_NOMAD_PERF += plutusv3-blst-nomadperf plutusv3-blst-half-nomadperf plutusv3-blst-double-nomadperf PROFILES_NOMAD_PERF_DREP := value-drep1k-nomadperf value-drep2k-nomadperf value-drep10k-nomadperf value-drep100k-nomadperf PROFILES_NOMAD_PERF_DREP += plutus-drep1k-nomadperf plutus-drep2k-nomadperf plutus-drep10k-nomadperf plutus-drep100k-nomadperf diff --git a/bench/plutus-scripts-bench/plutus-scripts-bench.cabal b/bench/plutus-scripts-bench/plutus-scripts-bench.cabal index 6c6937a8a1a..cfe5f3ecd9b 100644 --- a/bench/plutus-scripts-bench/plutus-scripts-bench.cabal +++ b/bench/plutus-scripts-bench/plutus-scripts-bench.cabal @@ -72,7 +72,7 @@ library Cardano.Benchmarking.PlutusScripts.CustomCall Cardano.Benchmarking.PlutusScripts.EcdsaSecp256k1Loop Cardano.Benchmarking.PlutusScripts.HashOntoG2AndAdd - Cardano.Benchmarking.PlutusScripts.Loop + Cardano.Benchmarking.PlutusScripts.Loop2024 Cardano.Benchmarking.PlutusScripts.LoopV3 Cardano.Benchmarking.PlutusScripts.SchnorrSecp256k1Loop diff --git a/bench/plutus-scripts-bench/src/Cardano/Benchmarking/PlutusScripts.hs b/bench/plutus-scripts-bench/src/Cardano/Benchmarking/PlutusScripts.hs index 28ce667426a..754643a0fc7 100644 --- a/bench/plutus-scripts-bench/src/Cardano/Benchmarking/PlutusScripts.hs +++ b/bench/plutus-scripts-bench/src/Cardano/Benchmarking/PlutusScripts.hs @@ -26,7 +26,7 @@ import Cardano.Api import qualified Cardano.Benchmarking.PlutusScripts.CustomCall as CustomCall import qualified Cardano.Benchmarking.PlutusScripts.EcdsaSecp256k1Loop as ECDSA import qualified Cardano.Benchmarking.PlutusScripts.HashOntoG2AndAdd as HashG2Add -import qualified Cardano.Benchmarking.PlutusScripts.Loop as Loop +import qualified Cardano.Benchmarking.PlutusScripts.Loop2024 as Loop2024 import qualified Cardano.Benchmarking.PlutusScripts.LoopV3 as LoopV3 import qualified Cardano.Benchmarking.PlutusScripts.SchnorrSecp256k1Loop as Schnorr import Cardano.Benchmarking.ScriptAPI @@ -37,7 +37,7 @@ getAllScripts = [ CustomCall.script , ECDSA.script , HashG2Add.script - , Loop.script + , Loop2024.script , LoopV3.script , Schnorr.script ] diff --git a/bench/plutus-scripts-bench/src/Cardano/Benchmarking/PlutusScripts/Loop.hs b/bench/plutus-scripts-bench/src/Cardano/Benchmarking/PlutusScripts/Loop2024.hs similarity index 96% rename from bench/plutus-scripts-bench/src/Cardano/Benchmarking/PlutusScripts/Loop.hs rename to bench/plutus-scripts-bench/src/Cardano/Benchmarking/PlutusScripts/Loop2024.hs index 903ade09ef0..d9ccac7961b 100644 --- a/bench/plutus-scripts-bench/src/Cardano/Benchmarking/PlutusScripts/Loop.hs +++ b/bench/plutus-scripts-bench/src/Cardano/Benchmarking/PlutusScripts/Loop2024.hs @@ -7,7 +7,7 @@ -- PlutusV1 must be compiled using plc 1.0 {-# OPTIONS_GHC -fplugin-opt PlutusTx.Plugin:target-version=1.0.0 #-} -module Cardano.Benchmarking.PlutusScripts.Loop (script) where +module Cardano.Benchmarking.PlutusScripts.Loop2024 (script) where import Language.Haskell.TH import Language.Haskell.TH.Syntax diff --git a/bench/tx-generator/data/Loop2024.redeemer.json b/bench/tx-generator/data/Loop2024.redeemer.json new file mode 100644 index 00000000000..55007f026cd --- /dev/null +++ b/bench/tx-generator/data/Loop2024.redeemer.json @@ -0,0 +1,3 @@ +{ + "int": 1000000 +} diff --git a/bench/tx-generator/scripts-fallback/Loop2024.plutus b/bench/tx-generator/scripts-fallback/Loop2024.plutus new file mode 100644 index 00000000000..a6a8cc2c7e4 --- /dev/null +++ b/bench/tx-generator/scripts-fallback/Loop2024.plutus @@ -0,0 +1,5 @@ +{ + "type": "PlutusScriptV1", + "description": "", + "cborHex": "583f583d01000032222325333573466e200052080897a1613005001375a0046460020024464a666ae68cdc3a410112f40042240022600266e04009200230020021" +} diff --git a/nix/workbench/profile/prof1-variants.jq b/nix/workbench/profile/prof1-variants.jq index ff4ce2d76a6..a5ceb3f90e5 100644 --- a/nix/workbench/profile/prof1-variants.jq +++ b/nix/workbench/profile/prof1-variants.jq @@ -442,6 +442,16 @@ def all_profile_variants: } | .generator.tx_fee = 1360000 ) as $plutus_loop_counter + | + ($plutus_loop_counter * + { generator: + { plutus: + { script: "Loop2024" + } + } + } + | .generator.tx_fee = 1412000 + ) as $plutus_loop2024_counter | ({ generator: { plutus: @@ -1010,6 +1020,9 @@ def all_profile_variants: , $cibench_base * $plutus_base * $costmodel_v8_preview * $plutus_loop_counter * { name: "ci-bench-plutus" } + , $cibench_base * $plutus_base * $costmodel_v8_preview * $plutus_loop2024_counter * + { name: "ci-bench-plutus24" + } , $cibench_base * $plutus_base * $costmodel_v8_preview * $plutus_loop_secp_ecdsa * { name: "ci-bench-plutus-secp-ecdsa" } @@ -1124,6 +1137,9 @@ def all_profile_variants: , $plutus_nomadperf_template * { name: "plutus-nomadperf" } + , $plutus_nomadperf_template * $plutus_loop2024_counter * + { name: "plutus24-nomadperf" + } , $nomad_perf_latency_base * $nomad_perf_dense * $p2p * $costmodel_v8_preview * { name: "latency-nomadperf" } From 7858309d5b4c2611ca618800e1f6de1cc7d35dc7 Mon Sep 17 00:00:00 2001 From: Michael Karg Date: Mon, 27 May 2024 17:44:00 +0200 Subject: [PATCH 19/21] locli | txgen: small fixes --- bench/locli/src/Cardano/Report.hs | 2 +- bench/tx-generator/test/ApiTest.hs | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/bench/locli/src/Cardano/Report.hs b/bench/locli/src/Cardano/Report.hs index 456795d2bc4..16fc89e3c5f 100644 --- a/bench/locli/src/Cardano/Report.hs +++ b/bench/locli/src/Cardano/Report.hs @@ -146,7 +146,7 @@ liftTmplRun Summary{sumWorkload=generatorProfile case plutusLoopScript generatorProfile of Nothing -> WValue Just script - | script `elem` ["Loop", "LoopV3"] -> WPlutusLoopCountdown + | "Loop" `T.isPrefixOf` script -> WPlutusLoopCountdown | script == "EcdsaSecp256k1Loop" -> WPlutusLoopSECP | script == "SchnorrSecp256k1Loop" -> WPlutusLoopSECP | script == "HashOntoG2AndAdd" -> WPlutusLoopBLST diff --git a/bench/tx-generator/test/ApiTest.hs b/bench/tx-generator/test/ApiTest.hs index 34d0108dfc5..d58af8af29f 100644 --- a/bench/tx-generator/test/ApiTest.hs +++ b/bench/tx-generator/test/ApiTest.hs @@ -106,11 +106,9 @@ main putStrLn "* Can I pre-execute a plutus script?" let plutus = _nix_plutus nixService case plutusType <$> plutus of - Just LimitSaturationLoop -> checkPlutusLoop protoParamPath plutus Just BenchCustomCall -> checkPlutusBuiltin protoParamPath - _ -> putStrLn $ "plutusType " - ++ show plutus - ++ " unrecognised" + Just{} -> checkPlutusLoop protoParamPath plutus + Nothing -> putStrLn "--> no Plutus configuration found - skipping" exitSuccess -- The type annotations within patterns or expressions that would be From eec6fd2ebe2b8d9661cb8ab86665c957cae0e094 Mon Sep 17 00:00:00 2001 From: Michael Karg Date: Mon, 27 May 2024 21:06:32 +0200 Subject: [PATCH 20/21] wb | profiles: update SECP scripts --- .../scripts-fallback/EcdsaSecp256k1Loop.plutus | 2 +- .../scripts-fallback/SchnorrSecp256k1Loop.plutus | 2 +- .../scripts-legacy/EcdsaSecp256k1Loop_2023.plutus | 5 +++++ .../SchnorrSecp256k1Loop_2023.plutus | 5 +++++ .../analyse/chain-filters/size-moderate.json | 4 ++-- nix/workbench/profile/prof1-variants.jq | 14 ++++++++------ 6 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 bench/tx-generator/scripts-legacy/EcdsaSecp256k1Loop_2023.plutus create mode 100644 bench/tx-generator/scripts-legacy/SchnorrSecp256k1Loop_2023.plutus diff --git a/bench/tx-generator/scripts-fallback/EcdsaSecp256k1Loop.plutus b/bench/tx-generator/scripts-fallback/EcdsaSecp256k1Loop.plutus index 385788a4dd2..33836d9d16a 100644 --- a/bench/tx-generator/scripts-fallback/EcdsaSecp256k1Loop.plutus +++ b/bench/tx-generator/scripts-fallback/EcdsaSecp256k1Loop.plutus @@ -1,5 +1,5 @@ { "type": "PlutusScriptV2", "description": "", - "cborHex": "5901ea5901e7010000323232332232332232223232323232253353232323333333574801446666ae68cdc39aab9d500a480008cccd55cfa8051280811999aab9f500a25011233335573ea0144a02446666aae7d40289404c8cccd55cf9aba2500b2533532333333357480024a02c4a02c4a02c46a02e6eb400894058070d5d0a80790a99a98059aba1500f215335300b35742a01e42a66a60166ae85403c84d406448cccc00401401000c0085405c5405854054540509405006806406005c0589403c05094038940389403894038051402d4029402484d400488894cd4ccd5cd19b880044820225e804c0484d40512411572656465656d6572206973203c2031303030303030001333301100400300200113500f49011d5472616365206572726f723a20496e76616c69642072656465656d657200135744a00226ae8940044d5d1280089aab9e500113754002246666666ae900049400c9400c9400c9400c8d4010dd700100489091180100188910009918008009119111299a999ab9a3370e00a904044bd00400388058a99a999ab9a33376800600400201000e2666600866e040152002003002001135009491245472616365206572726f723a2045434453412076616c69646174696f6e206661696c65640030020021220021220011232632003335738002006930900081" + "cborHex": "5902255902220100003232322225335332233333233001005225333573466e1d2000002153323533335573e0044a00c4600e660046ae8400cd5d1001806109a80091299a9999998038011128051280492804918050009280490a99a9999aab9f0022500a2300b33006357420066ae8800c04084d4004894cd4cccccc02c0088940389403494034940348c038004854cd4cccd55cf8011280711807998051aba100335744006028426a00244a66a66666601e00444a0244a0224a0224a0224602400242a66a6666aae7c008940488c8c8c054008d5d10021aba10030182153353333330110012250142501325013250132301400121301412333300100c0080040021501215011150101500d1500c150091500822123300100300215004150042222223333333574800c4646600e6aae74004d55cf0009baa00723005375600e460086eb001c8c00cdd6803918011bae00700e25002250022500225002212230020031122001213500122225333573466e200112080897a1300a4911572656465656d6572206973203c20313030303030300013333009004003002001130054911d5472616365206572726f723a20496e76616c69642072656465656d65720032300100122322225333573466e1d2080897a0051008153335734666ed000c0080044cccc010cdc0802a40040060040022600e9201245472616365206572726f723a2045434453412076616c69646174696f6e206661696c6564003002002232633573800200424003" } diff --git a/bench/tx-generator/scripts-fallback/SchnorrSecp256k1Loop.plutus b/bench/tx-generator/scripts-fallback/SchnorrSecp256k1Loop.plutus index 7b683b1e1ab..e5101e166f0 100644 --- a/bench/tx-generator/scripts-fallback/SchnorrSecp256k1Loop.plutus +++ b/bench/tx-generator/scripts-fallback/SchnorrSecp256k1Loop.plutus @@ -1,5 +1,5 @@ { "type": "PlutusScriptV2", "description": "", - "cborHex": "5901ec5901e9010000323232332232332232223232323232253353232323333333574801446666ae68cdc39aab9d500a480008cccd55cfa8051280811999aab9f500a25011233335573ea0144a02446666aae7d40289404c8cccd55cf9aba2500b2533532333333357480024a02c4a02c4a02c46a02e6eb400894058070d5d0a80790a99a98059aba1500f215335300b35742a01e42a66a60166ae85403c84d406448cccc00401401000c0085405c5405854054540509405006806406005c0589403c05094038940389403894038051402d4029402484d400488894cd4ccd5cd19b880044820225e804c0484d40512411572656465656d6572206973203c2031303030303030001333301100400300200113500f49011d5472616365206572726f723a20496e76616c69642072656465656d657200135744a00226ae8940044d5d1280089aab9e500113754002246666666ae900049400c9400c9400c9400c8d4010dd700100489091180100188910009918008009119111299a999ab9a3370e00a904044bd00400388058a99a999ab9a33376a00600400201000e2666600866e040152002003002001135009491265472616365206572726f723a205363686e6f72722076616c69646174696f6e206661696c65640030020021220021220011232632003335738002006930900081" + "cborHex": "5902275902240100003232322225335332233333233001005225333573466e1d2000002153323533335573e0044a00c4600e660046ae8400cd5d1001806109a80091299a9999998038011128051280492804918050009280490a99a9999aab9f0022500a2300b33006357420066ae8800c04084d4004894cd4cccccc02c0088940389403494034940348c038004854cd4cccd55cf8011280711807998051aba100335744006028426a00244a66a66666601e00444a0244a0224a0224a0224602400242a66a6666aae7c008940488c8c8c054008d5d10021aba10030182153353333330110012250142501325013250132301400121301412333300100c0080040021501215011150101500d1500c150091500822123300100300215004150042222223333333574800c4646600e6aae74004d55cf0009baa00723005375600e460086eb001c8c00cdd6803918011bae00700e25002250022500225002212230020031122001213500122225333573466e200112080897a1300a4911572656465656d6572206973203c20313030303030300013333009004003002001130054911d5472616365206572726f723a20496e76616c69642072656465656d65720032300100122322225333573466e1d2080897a0051008153335734666ed400c0080044cccc010cdc0802a40040060040022600e9201265472616365206572726f723a205363686e6f72722076616c69646174696f6e206661696c6564003002002232633573800200424003" } diff --git a/bench/tx-generator/scripts-legacy/EcdsaSecp256k1Loop_2023.plutus b/bench/tx-generator/scripts-legacy/EcdsaSecp256k1Loop_2023.plutus new file mode 100644 index 00000000000..385788a4dd2 --- /dev/null +++ b/bench/tx-generator/scripts-legacy/EcdsaSecp256k1Loop_2023.plutus @@ -0,0 +1,5 @@ +{ + "type": "PlutusScriptV2", + "description": "", + "cborHex": "5901ea5901e7010000323232332232332232223232323232253353232323333333574801446666ae68cdc39aab9d500a480008cccd55cfa8051280811999aab9f500a25011233335573ea0144a02446666aae7d40289404c8cccd55cf9aba2500b2533532333333357480024a02c4a02c4a02c46a02e6eb400894058070d5d0a80790a99a98059aba1500f215335300b35742a01e42a66a60166ae85403c84d406448cccc00401401000c0085405c5405854054540509405006806406005c0589403c05094038940389403894038051402d4029402484d400488894cd4ccd5cd19b880044820225e804c0484d40512411572656465656d6572206973203c2031303030303030001333301100400300200113500f49011d5472616365206572726f723a20496e76616c69642072656465656d657200135744a00226ae8940044d5d1280089aab9e500113754002246666666ae900049400c9400c9400c9400c8d4010dd700100489091180100188910009918008009119111299a999ab9a3370e00a904044bd00400388058a99a999ab9a33376800600400201000e2666600866e040152002003002001135009491245472616365206572726f723a2045434453412076616c69646174696f6e206661696c65640030020021220021220011232632003335738002006930900081" +} diff --git a/bench/tx-generator/scripts-legacy/SchnorrSecp256k1Loop_2023.plutus b/bench/tx-generator/scripts-legacy/SchnorrSecp256k1Loop_2023.plutus new file mode 100644 index 00000000000..7b683b1e1ab --- /dev/null +++ b/bench/tx-generator/scripts-legacy/SchnorrSecp256k1Loop_2023.plutus @@ -0,0 +1,5 @@ +{ + "type": "PlutusScriptV2", + "description": "", + "cborHex": "5901ec5901e9010000323232332232332232223232323232253353232323333333574801446666ae68cdc39aab9d500a480008cccd55cfa8051280811999aab9f500a25011233335573ea0144a02446666aae7d40289404c8cccd55cf9aba2500b2533532333333357480024a02c4a02c4a02c46a02e6eb400894058070d5d0a80790a99a98059aba1500f215335300b35742a01e42a66a60166ae85403c84d406448cccc00401401000c0085405c5405854054540509405006806406005c0589403c05094038940389403894038051402d4029402484d400488894cd4ccd5cd19b880044820225e804c0484d40512411572656465656d6572206973203c2031303030303030001333301100400300200113500f49011d5472616365206572726f723a20496e76616c69642072656465656d657200135744a00226ae8940044d5d1280089aab9e500113754002246666666ae900049400c9400c9400c9400c8d4010dd700100489091180100188910009918008009119111299a999ab9a3370e00a904044bd00400388058a99a999ab9a33376a00600400201000e2666600866e040152002003002001135009491265472616365206572726f723a205363686e6f72722076616c69646174696f6e206661696c65640030020021220021220011232632003335738002006930900081" +} diff --git a/nix/workbench/analyse/chain-filters/size-moderate.json b/nix/workbench/analyse/chain-filters/size-moderate.json index a6651a8e879..02e1e7c2edc 100644 --- a/nix/workbench/analyse/chain-filters/size-moderate.json +++ b/nix/workbench/analyse/chain-filters/size-moderate.json @@ -1,13 +1,13 @@ [ { "tag": "CBlock" , "contents": { "tag": "BFullnessGEq" - , "contents": 0.03 + , "contents": 0.08 } } , { "tag": "CBlock" , "contents": { "tag": "BFullnessLEq" - , "contents": 0.2 + , "contents": 0.112 } } ] diff --git a/nix/workbench/profile/prof1-variants.jq b/nix/workbench/profile/prof1-variants.jq index a5ceb3f90e5..17044a1a400 100644 --- a/nix/workbench/profile/prof1-variants.jq +++ b/nix/workbench/profile/prof1-variants.jq @@ -473,7 +473,7 @@ def all_profile_variants: } } } - | .generator.tx_fee = 1025000 + | .generator.tx_fee = 1008000 ) as $plutus_loop_secp_ecdsa | ({ generator: @@ -496,7 +496,7 @@ def all_profile_variants: } } } - | .generator.tx_fee = 1020000 + | .generator.tx_fee = 1004000 ) as $plutus_loop_secp_schnorr | ({ generator: @@ -1023,16 +1023,18 @@ def all_profile_variants: , $cibench_base * $plutus_base * $costmodel_v8_preview * $plutus_loop2024_counter * { name: "ci-bench-plutus24" } - , $cibench_base * $plutus_base * $costmodel_v8_preview * $plutus_loop_secp_ecdsa * + , $cibench_base * $plutus_base * $double_plus_tps_saturation_plutus * $costmodel_v8_preview * $plutus_loop_secp_ecdsa * { name: "ci-bench-plutus-secp-ecdsa" + , analysis: + { filters: ["size-moderate"] } } - , $cibench_base * $plutus_base * $costmodel_v8_preview * $plutus_loop_secp_schnorr * + , $cibench_base * $plutus_base * $double_plus_tps_saturation_plutus * $costmodel_v8_preview * $plutus_loop_secp_schnorr * { name: "ci-bench-plutus-secp-schnorr" + , analysis: + { filters: ["size-moderate"] } } , $cibench_base * $plutus_base * $double_plus_tps_saturation_plutus * $costmodel_v9_preview * $plutus_loop_blst * { name: "ci-bench-plutusv3-blst" - , genesis: - { max_block_size: 88000 } , analysis: { filters: ["size-moderate-2"] } } From 6aedb41ebf24b1896499a2acde645d672edb3895 Mon Sep 17 00:00:00 2001 From: Michael Karg Date: Tue, 28 May 2024 09:54:12 +0200 Subject: [PATCH 21/21] wb | profiles: SECP cluster profiles --- Makefile | 1 + .../profile/pparams/delta-v8-preview.jq | 2 ++ nix/workbench/profile/prof1-variants.jq | 21 ++++++++++++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6f11a5724d1..fc952643706 100644 --- a/Makefile +++ b/Makefile @@ -100,6 +100,7 @@ PROFILES_VENDOR := dish dish-plutus dish-10M dish-10M-plutus PROFILES_NOMAD_PERF := default-nomadperf ci-test-nomadperf ci-bench-nomadperf value-nomadperf oldtracing-nomadperf ci-test-oldtracing-nomadperf ci-bench-oldtracing-nomadperf value-oldtracing-nomadperf PROFILES_NOMAD_PERF += plutus-nomadperf plutus24-nomadperf fast-nomadperf latency-nomadperf PROFILES_NOMAD_PERF += plutusv3-blst-nomadperf plutusv3-blst-half-nomadperf plutusv3-blst-double-nomadperf +PROFILES_NOMAD_PERF += plutus-secp-ecdsa-nomadperf plutus-secp-schnorr-nomadperf PROFILES_NOMAD_PERF_DREP := value-drep1k-nomadperf value-drep2k-nomadperf value-drep10k-nomadperf value-drep100k-nomadperf PROFILES_NOMAD_PERF_DREP += plutus-drep1k-nomadperf plutus-drep2k-nomadperf plutus-drep10k-nomadperf plutus-drep100k-nomadperf PROFILES_NOMAD_PERF_NOP2P := default-nomadperf-nop2p oldtracing-nomadperf-nop2p ci-test-nomadperf-nop2p ci-bench-nomadperf-nop2p diff --git a/nix/workbench/profile/pparams/delta-v8-preview.jq b/nix/workbench/profile/pparams/delta-v8-preview.jq index b26b4791fe8..791d605d82d 100644 --- a/nix/workbench/profile/pparams/delta-v8-preview.jq +++ b/nix/workbench/profile/pparams/delta-v8-preview.jq @@ -113,6 +113,8 @@ def delta: "verifyEd25519Signature-memory-arguments": 10 }, "PlutusV2": { + "verifyEd25519Signature-cpu-arguments-intercept": 57996947, + "verifyEd25519Signature-cpu-arguments-slope": 18975 } } }; diff --git a/nix/workbench/profile/prof1-variants.jq b/nix/workbench/profile/prof1-variants.jq index 17044a1a400..4eaae5b01eb 100644 --- a/nix/workbench/profile/prof1-variants.jq +++ b/nix/workbench/profile/prof1-variants.jq @@ -764,6 +764,15 @@ def all_profile_variants: { tps: 2.0 } }) as $nomad_perf_plutusv3blst_base + | + ($nomad_perf_plutus_common_base * + { analysis: + { filters: ["epoch3+", "size-moderate"] + } + , generator: + { tps: 2.0 + } + }) as $nomad_perf_plutussecp_base | ($scenario_latency * $compose_fiftytwo * $dataset_empty * $no_filtering * { desc: "AWS perf class cluster, stop when all latency services stop" @@ -886,6 +895,10 @@ def all_profile_variants: ($nomad_perf_plutusv3blst_base * $nomad_perf_dense * $p2p * $costmodel_v9_preview ) as $plutusv3blst_nomadperf_template | + # P&T Nomad cluster: 52 nodes, P2P by default - Plutus SECP workload + ($nomad_perf_plutussecp_base * $nomad_perf_dense * $p2p * $costmodel_v8_preview + ) as $plutussecp_nomadperf_template + | ### First, auto-named profiles: ### @@ -1149,7 +1162,7 @@ def all_profile_variants: { name: "latency-nomadperfssd" } -## P&T Nomad cluster: 52 nodes, PlutusV3 BLST workloads +## P&T Nomad cluster: 52 nodes, PlutusV3 BLST and Plutus SECP workloads , $plutusv3blst_nomadperf_template * { name: "plutusv3-blst-nomadperf" } @@ -1159,6 +1172,12 @@ def all_profile_variants: , $plutusv3blst_nomadperf_template * $costmodel_v9_preview_doubleb * { name: "plutusv3-blst-double-nomadperf" } + , $plutussecp_nomadperf_template * $plutus_loop_secp_ecdsa * + { name: "plutus-secp-ecdsa-nomadperf" + } + , $plutussecp_nomadperf_template * $plutus_loop_secp_schnorr * + { name: "plutus-secp-schnorr-nomadperf" + } ## P&T Nomad cluster: 52 nodes, value-only and Plutus workloads - DRep injection variants , $value_nomadperf_template * $dreps_small *