Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20,974 changes: 14,165 additions & 6,809 deletions bench/cardano-profile/data/all-profiles.json

Large diffs are not rendered by default.

38 changes: 36 additions & 2 deletions bench/cardano-profile/data/genesis/overlays/v11-preview.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
{
"description": "Preview overlay for protocol version 11 (Van Rossem). Carries the PlutusV1 (166), PlutusV2 (147) and PlutusV3 (53) cost-model parameters that PV11 newly introduces, with values taken from the parameter-change governance action linked under `source`.",
"source": "https://gov.tools/governance_actions/c82f3834898e4d70d3605fa0d92ffe31345701075b107a54309c1525f9581f62#0",
"description": "Preview overlay for protocol version 11 (Van Rossem). Carries budget changes and cost model changes. PlutusV1 (169), PlutusV2 (160) and PlutusV3 (60) cost-model entries that PV11 changes: the newly-introduced parameters plus van Rossem's re-prices of a few existing ones, with values taken from the parameter-change governance action linked under `source`.",
"sources": [
"https://gov.tools/governance_actions/c21b00f90f18fce4003edf42b0b0d455126e01c946e80cc5341a9f9750caf795#0",
"https://gov.tools/governance_actions/c82f3834898e4d70d3605fa0d92ffe31345701075b107a54309c1525f9581f62#0"
],
"epoch_params": {
"alonzo": {
"maxTxExUnits": {
"exUnitsMem": 16500000
},
"maxBlockExUnits": {
"exUnitsMem": 72000000
}
},
"shelley": {
"protocolParams": {
"protocolVersion": {
Expand All @@ -18,6 +29,9 @@
},
"cost_model": {
"plutusV1": {
"equalsByteString-cpu-arguments-constant": 30623,
"equalsByteString-cpu-arguments-intercept": 28755,
"equalsByteString-cpu-arguments-slope": 75,
"serialiseData-cpu-arguments-intercept": 955506,
"serialiseData-cpu-arguments-slope": 213312,
"serialiseData-memory-arguments-intercept": 0,
Expand Down Expand Up @@ -186,6 +200,19 @@
"scaleValue-memory-arguments-slope": 21
},
"plutusV2": {
"equalsByteString-cpu-arguments-constant": 30623,
"equalsByteString-cpu-arguments-intercept": 28755,
"equalsByteString-cpu-arguments-slope": 75,
"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,
"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,
"cekConstrCost-exBudgetCPU": 16000,
"cekConstrCost-exBudgetMemory": 100,
"cekCaseCost-exBudgetCPU": 16000,
Expand Down Expand Up @@ -335,6 +362,13 @@
"scaleValue-memory-arguments-slope": 21
},
"plutusV3": {
"divideInteger-cpu-arguments-model-arguments-c11": 960,
"equalsByteString-cpu-arguments-constant": 30623,
"equalsByteString-cpu-arguments-intercept": 28755,
"equalsByteString-cpu-arguments-slope": 75,
"modInteger-cpu-arguments-model-arguments-c11": 960,
"quotientInteger-cpu-arguments-model-arguments-c11": 960,
"remainderInteger-cpu-arguments-model-arguments-c11": 960,
"expModInteger-cpu-arguments-coefficient00": 607153,
"expModInteger-cpu-arguments-coefficient11": 231697,
"expModInteger-cpu-arguments-coefficient12": 53144,
Expand Down
47 changes: 26 additions & 21 deletions bench/cardano-profile/src/Cardano/Benchmarking/Profile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -236,20 +236,21 @@ genesisParams epochParams g =
-- (since IntersectMBO/cardano-ledger#5379 restricted to PlutusV1).
-- * `conway.plutusV3CostModel` is array-only, exactly 251 entries
-- (since IntersectMBO/cardano-ledger#5241 enforced the count there).
-- Any cost-parameter ADDITIONS subsequent hard forks made on mainnet (the 10
-- V2 entries added at Chang, the 46 V3 entries added at epoch 537) are
-- applied internally by the hard-fork combinator based on the protocol
-- version, not by extending those genesis fields.
-- Any cost-parameter ADDITIONS made on mainnet after each language's
-- introduction (V3 +46 at Plomin/epoch 537; then V1 +166, V2 +157 and V3 +53
-- at van Rossem/PV11, epoch 638) arrive as on-chain updates to the
-- `costModels` protocol parameter, not by extending those count-locked
-- genesis fields.
-- `alonzo.extraConfig.costModels` was added to bypass those structural locks
-- for testnets and benchmarks (IntersectMBO/cardano-ledger#5342, landed in
-- IntersectMBO/cardano-ledger#5379; surfaced for cardano-cli in
-- IntersectMBO/cardano-cli#1352): it accepts V1/V2/V3 keys and skips the
-- exact-count check the top-level parsers enforce. Its object form is
-- still capped at each language's init names (extras are silently dropped
-- at parse time), so the ARRAY form is the only one that actually carries
-- entries past those counts, and that is what we emit there.
-- `alonzoInjectCostModels` applies the content as a per-language
-- REPLACEMENT at the Alonzo era transition.
-- exact-count check the top-level parsers enforce. Its object form is still
-- capped at each language's init names (extras are silently dropped at parse
-- time), so the ARRAY form is the only one that actually carries entries past
-- those counts, and that is what we emit there.
-- `alonzoInjectCostModels` applies the content as a per-language REPLACEMENT
-- at the Alonzo era transition.
--
-- Expects `genesisParams` (Step 2a) to have already populated the base
-- "alonzo" and "conway" KeyMaps on the Genesis.
Expand Down Expand Up @@ -277,14 +278,15 @@ genesisCostModels costModel g =
-- alonzo-genesis.json.
--
-- Updated: Vasil (epoch 366) tweaked 100 entries; Valentine (394) tweaked
-- 2; Chang (507) tweaked 85. V1 has never gained a parameter, total is
-- still 166.
-- 2; Chang (507) tweaked 85. V1 gained no parameters until van Rossem/PV11
-- (epoch 638), which ADDED 166 (current total 332).
--
-- Placement: We emit the first 166 canonical entries as the OBJECT at
-- `alonzo.costModels.PlutusV1` (mainnet shape). If the input ever carries
-- more than 166 entries (future proofing), the FULL set also goes as an
-- ARRAY to `alonzo.extraConfig.costModels.PlutusV1`; the lenient parser
-- defers array length validation to Plutus's mkEvaluationContext.
-- `alonzo.costModels.PlutusV1` (mainnet shape). When the input carries
-- more than 166 entries (as it does at van Rossem/PV11), the FULL set
-- also goes as an ARRAY to `alonzo.extraConfig.costModels.PlutusV1`; the
-- lenient parser defers array length validation to Plutus's
-- mkEvaluationContext.
--
-- Naming: If any of the extras have a name not in `plutusV1CostNames`,
-- the list throws an error (on purpose), signalling that the workbench's
Expand Down Expand Up @@ -316,7 +318,9 @@ genesisCostModels costModel g =
-- 175 named cost parameters.
--
-- Updated: Valentine (epoch 394) tweaked 7 entries; Chang (epoch 507)
-- ADDED 10 new and tweaked 90 (current total 185).
-- tweaked 90 entries but added none (V2 stayed 175). van Rossem/PV11
-- (epoch 638, gov action c82f3834...) ADDED 157 and re-priced some
-- existing (current total 332).
--
-- Placement: V2 has no top-level home (`alonzo.costModels` is V1-only),
-- so its only path to runtime is `alonzo.extraConfig.costModels.PlutusV2`.
Expand Down Expand Up @@ -346,8 +350,9 @@ genesisCostModels costModel g =
-- ARRAY of 251 cost parameters at `conway.plutusV3CostModel` in
-- conway-genesis.json.
--
-- Updated: at epoch 537 an on-chain parameter update ADDED 46 new entries
-- (current total 297).
-- Updated: at epoch 537 (Plomin) an on-chain parameter update ADDED 46
-- new entries (total 297); van Rossem/PV11 (epoch 638) ADDED 53 more
-- (current total 350).
--
-- Placement: We emit the canonical first 251 entries as the ARRAY at
-- `conway.plutusV3CostModel` (mainnet shape). When the input carries
Expand Down Expand Up @@ -377,8 +382,8 @@ genesisCostModels costModel g =
then Just (Aeson.toJSON full)
else Nothing
in (Just topLevel, extra)
-- alonzo.extraConfig.costModels content: a PlutusV* sub-key is
-- included only when its version yielded a Just above.
-- alonzo.extraConfig.costModels content: a PlutusV* sub-key is included
-- only when its version yielded a Just above.
extraEntries = catMaybes
[ (,) "PlutusV1" <$> v1AtExtra
, (,) "PlutusV2" <$> v2AtExtra
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ profilesCloud =
-- Plutus (post-Voltaire profiles)
, loopVolt & P.name "plutus-volt-nomadperf" . P.dreps 10000
, loopV3Volt & P.name "plutusv3-volt-nomadperf" . P.dreps 10000
, loopV3Volt & P.name "plutusv3-voltv11-nomadperf" . P.dreps 10000 . P.v11Preview
, loopVolt & P.name "plutus-volt-memx15-nomadperf" . P.dreps 10000 . blockMem15x
, loopVolt & P.name "plutus-volt-memx2-nomadperf" . P.dreps 10000 . blockMem2x
, loopVolt & P.name "plutus-volt-rtsqg1-nomadperf" . P.dreps 10000 . P.rtsGcParallel . P.rtsGcLoadBalance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ profilesMiniature =
ciBench10Plutus = ciBench10 & V.genesisVariant300

loop = V.plutusSaturation . V.plutusTypeLoop . P.analysisSizeSmall
loopV3 = V.plutusSaturation . V.plutusTypeLoopV3 . P.analysisSizeSmall
loop2024 = V.plutusSaturation . V.plutusTypeLoop2024 . P.analysisSizeSmall
ecdsa = V.plutusDoublePlusSaturation . V.plutusTypeECDSA . P.analysisSizeModerate
schnorr = V.plutusDoublePlusSaturation . V.plutusTypeSchnorr . P.analysisSizeModerate
Expand All @@ -89,6 +90,8 @@ profilesMiniature =
, ciBench02Value & P.name "ci-bench-notracer" . V.valueLocal . P.dreps 0 . P.traceForwardingOff
, ciBench02Value & P.name "ci-bench-drep" . V.valueLocal . P.dreps 10 . P.traceForwardingOn
, ciBench02Plutus & P.name "ci-bench-plutus" . loop . P.dreps 0 . P.traceForwardingOn
, ciBench02PlutusV3 & P.name "ci-bench-v11-plutus" . loop . P.dreps 0 . P.traceForwardingOn . P.v11Preview
, ciBench02PlutusV3 & P.name "ci-bench-v11-plutusv3" . loopV3 . P.dreps 0 . P.traceForwardingOn . P.v11Preview
, ciBench02Plutus & P.name "ci-bench-plutus24" . loop2024 . P.dreps 0 . P.traceForwardingOn
, ciBench02Plutus & P.name "ci-bench-plutus-secp-ecdsa" . ecdsa . P.dreps 0 . P.traceForwardingOn
, ciBench02Plutus & P.name "ci-bench-plutus-secp-schnorr" . schnorr . P.dreps 0 . P.traceForwardingOn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,6 @@ profilesPlutuscall =
, loopVolt & P.name "plutuscall-volt-loop" . postPlomin
, blstVolt & P.name "plutuscall-volt-blst" . postPlomin
, ripemdVolt & P.name "plutuscall-volt-ripemd" . postPlomin

, ripemdVolt & P.name "plutuscall-voltv11-ripemd" . postPlomin . P.v11Preview
]
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,8 @@ plutusV1CostNames =
, "verifySignature-cpu-arguments-slope"
, "verifySignature-memory-arguments"
--------------------------------------------------
-- Positions 166..331 (166 entries): PV11 (Van Rossem) additions.
-- Not yet enacted on mainnet. See governance action:
-- Positions 166..331 (166 entries): van Rossem (enacted on epoch 638).
-- See governance action:
-- gov_action1eqhnsdyf3exhp5mqt7sdjtl7xy69wqg8tvg854psns2jt72cra3qqrcnr8r
-- (https://gov.tools/governance_actions/c82f3834898e4d70d3605fa0d92ffe31345701075b107a54309c1525f9581f62).
, "serialiseData-cpu-arguments-intercept"
Expand Down Expand Up @@ -750,9 +750,10 @@ plutusV2CostNames =
, "verifySchnorrSecp256k1Signature-cpu-arguments-intercept"
, "verifySchnorrSecp256k1Signature-cpu-arguments-slope"
, "verifySchnorrSecp256k1Signature-memory-arguments"
-- Positions 175..184 (10 entries):
-- post-Vasil on-chain parameter update at mainnet epoch 492
-- (integerToByteString, byteStringToInteger).
-- Positions 175..331 (157 entries): van Rossem (enacted on epoch 638).
-- See governance action:
-- gov_action1eqhnsdyf3exhp5mqt7sdjtl7xy69wqg8tvg854psns2jt72cra3qqrcnr8r
-- (https://gov.tools/governance_actions/c82f3834898e4d70d3605fa0d92ffe31345701075b107a54309c1525f9581f62).
, "integerToByteString-cpu-arguments-c0"
, "integerToByteString-cpu-arguments-c1"
, "integerToByteString-cpu-arguments-c2"
Expand All @@ -763,10 +764,6 @@ plutusV2CostNames =
, "byteStringToInteger-cpu-arguments-c2"
, "byteStringToInteger-memory-arguments-intercept"
, "byteStringToInteger-memory-arguments-slope"
-- Positions 185..331 (147 entries): PV11 (Van Rossem) additions.
-- Not yet enacted on mainnet. See governance action:
-- gov_action1eqhnsdyf3exhp5mqt7sdjtl7xy69wqg8tvg854psns2jt72cra3qqrcnr8r
-- (https://gov.tools/governance_actions/c82f3834898e4d70d3605fa0d92ffe31345701075b107a54309c1525f9581f62).
, "cekConstrCost-exBudgetCPU"
, "cekConstrCost-exBudgetMemory"
, "cekCaseCost-exBudgetCPU"
Expand Down Expand Up @@ -1225,8 +1222,8 @@ plutusV3CostNames =
, "ripemd_160-cpu-arguments-intercept"
, "ripemd_160-cpu-arguments-slope"
, "ripemd_160-memory-arguments"
-- Positions 297..349 (53 entries): PV11 (Van Rossem) additions.
-- Not yet enacted on mainnet. See governance action:
-- Positions 297..349 (53 entries): van Rossem (enacted on epoch 638).
-- See governance action:
-- gov_action1eqhnsdyf3exhp5mqt7sdjtl7xy69wqg8tvg854psns2jt72cra3qqrcnr8r
-- (https://gov.tools/governance_actions/c82f3834898e4d70d3605fa0d92ffe31345701075b107a54309c1525f9581f62).
, "expModInteger-cpu-arguments-coefficient00"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module Cardano.Benchmarking.Profile.Primitives (
-- Set the epoch number from the "epoch-timeline".
, pparamsEpoch
-- Overlays to use.
, v8Preview, v9Preview
, v8Preview, v9Preview, v11Preview
-- Budget overlays:
-- -- Block:
-- -- -- Steps:
Expand Down Expand Up @@ -419,6 +419,9 @@ v8Preview = helper_addOverlayOrDie "v8-preview"
v9Preview :: HasCallStack => Types.Profile -> Types.Profile
v9Preview = helper_addOverlayOrDie "v9-preview"

v11Preview :: HasCallStack => Types.Profile -> Types.Profile
v11Preview = helper_addOverlayOrDie "v11-preview"

-- Budget:

-- Steps:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,19 +190,19 @@ plutusTypeLoop :: Types.Profile -> Types.Profile
plutusTypeLoop =
P.plutusType "LimitSaturationLoop" . P.plutusScript "Loop"
. P.redeemerInt 1000000
. P.txFee 1360000
. P.txFee 1415000

plutusTypeLoopV3 :: Types.Profile -> Types.Profile
plutusTypeLoopV3 =
P.plutusType "LimitSaturationLoop" . P.plutusScript "LoopV3"
. P.redeemerInt 1000000
. P.txFee 1412000
. P.txFee 1452000

plutusTypeLoop2024 :: Types.Profile -> Types.Profile
plutusTypeLoop2024 =
P.plutusType "LimitSaturationLoop" . P.plutusScript "Loop2024"
. P.redeemerInt 1000000
. P.txFee 1412000
. P.txFee 1415000

plutusTypeECDSA :: Types.Profile -> Types.Profile
plutusTypeECDSA =
Expand Down
4 changes: 3 additions & 1 deletion bench/plutus-scripts-bench/plutus-scripts-bench.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ common common-definitions
default-language: Haskell2010
default-extensions:
NoImplicitPrelude
ImportQualifiedPost
OverloadedStrings

ghc-options:
Expand Down Expand Up @@ -70,12 +69,15 @@ library

other-modules:
Cardano.Benchmarking.PlutusScripts.CustomCall
Cardano.Benchmarking.PlutusScripts.CustomCallV3
Cardano.Benchmarking.PlutusScripts.EcdsaSecp256k1Loop
Cardano.Benchmarking.PlutusScripts.EcdsaSecp256k1LoopV3
Cardano.Benchmarking.PlutusScripts.HashOntoG2AndAdd
Cardano.Benchmarking.PlutusScripts.Loop2024
Cardano.Benchmarking.PlutusScripts.LoopV3
Cardano.Benchmarking.PlutusScripts.Ripemd160
Cardano.Benchmarking.PlutusScripts.SchnorrSecp256k1Loop
Cardano.Benchmarking.PlutusScripts.SchnorrSecp256k1LoopV3
Cardano.Benchmarking.PlutusScripts.SupplementalDatum

--------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}

Expand All @@ -24,25 +23,31 @@ import System.FilePath (takeBaseName)
import Cardano.Api

import qualified Cardano.Benchmarking.PlutusScripts.CustomCall as CustomCall
import qualified Cardano.Benchmarking.PlutusScripts.CustomCallV3 as CustomCallV3
import qualified Cardano.Benchmarking.PlutusScripts.EcdsaSecp256k1Loop as ECDSA
import qualified Cardano.Benchmarking.PlutusScripts.EcdsaSecp256k1LoopV3 as ECDSAV3
import qualified Cardano.Benchmarking.PlutusScripts.HashOntoG2AndAdd as HashG2Add
import qualified Cardano.Benchmarking.PlutusScripts.Loop2024 as Loop2024
import qualified Cardano.Benchmarking.PlutusScripts.LoopV3 as LoopV3
import qualified Cardano.Benchmarking.PlutusScripts.Ripemd160 as Ripemd160
import qualified Cardano.Benchmarking.PlutusScripts.SchnorrSecp256k1Loop as Schnorr
import qualified Cardano.Benchmarking.PlutusScripts.SchnorrSecp256k1LoopV3 as SchnorrV3
import qualified Cardano.Benchmarking.PlutusScripts.SupplementalDatum as SupplementalDatum
import Cardano.Benchmarking.ScriptAPI


getAllScripts :: [PlutusBenchScript]
getAllScripts =
[ CustomCall.script
, CustomCallV3.script
, ECDSA.script
, ECDSAV3.script
, HashG2Add.script
, Loop2024.script
, LoopV3.script
, Ripemd160.script
, Schnorr.script
, SchnorrV3.script
, SupplementalDatum.script
]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ImportQualifiedPost #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}

{-# OPTIONS_GHC -fno-warn-orphans #-}

Expand All @@ -12,30 +9,24 @@

module Cardano.Benchmarking.PlutusScripts.CustomCall (script) where

import Cardano.Api (PlutusScript (..), PlutusScriptV2, PlutusScriptVersion (..),
Script (..), toScriptInAnyLang)

import Cardano.Api (PlutusScriptVersion (PlutusScriptV2))
import Cardano.Benchmarking.PlutusScripts.CustomCallTypes
import Cardano.Benchmarking.ScriptAPI
import Cardano.Benchmarking.ScriptAPI (PlutusBenchScript, mkPlutusBenchScript)
import Language.Haskell.TH.Syntax (Exp (LitE), Lit (StringL), Loc (loc_module), qLocation)
import PlutusLedgerApi.Common (serialiseCompiledCode)
import qualified PlutusLedgerApi.V2 as PlutusV2

import Prelude as Haskell (String, (.), (<$>))

import qualified Data.ByteString.Short as SBS

import Language.Haskell.TH
import Language.Haskell.TH.Syntax
import qualified PlutusTx
import qualified PlutusTx (compile)
import PlutusTx.Foldable (sum)
import PlutusTx.List (all, length)
import PlutusTx.Prelude as Plutus hiding (Semigroup (..), (.), (<$>))
import Prelude as Haskell ((.), (<$>))

script :: PlutusBenchScript
script = mkPlutusBenchScript scriptName (toScriptInAnyLang (PlutusScript PlutusScriptV2 scriptSerialized))

scriptName :: Haskell.String
scriptName
= prepareScriptName $(LitE . StringL . loc_module <$> qLocation)
script :: PlutusBenchScript
script = mkPlutusBenchScript
$(LitE . StringL . loc_module <$> qLocation)
PlutusScriptV2
(serialiseCompiledCode $$(PlutusTx.compile [|| mkValidator ||]))


instance Plutus.Eq CustomCallData where
Expand Down Expand Up @@ -73,8 +64,3 @@ unwrap :: BuiltinData -> CustomCallArg
unwrap = PlutusV2.unsafeFromBuiltinData
-- Note: type-constraining unsafeFromBuiltinData decreases script's execution units.

customCallScriptShortBs :: SBS.ShortByteString
customCallScriptShortBs = PlutusV2.serialiseCompiledCode $$(PlutusTx.compile [|| mkValidator ||])

scriptSerialized :: PlutusScript PlutusScriptV2
scriptSerialized = PlutusScriptSerialised customCallScriptShortBs
Loading
Loading