diff --git a/cardano-api/cardano-api.cabal b/cardano-api/cardano-api.cabal index 2fbd3c7c4c..f8056cc531 100644 --- a/cardano-api/cardano-api.cabal +++ b/cardano-api/cardano-api.cabal @@ -34,7 +34,7 @@ common project-config -Wredundant-constraints -Wunused-packages - if impl(ghc < 9) + if impl(ghc <9) ghc-options: -Wno-incomplete-patterns common maybe-unix @@ -46,7 +46,7 @@ common maybe-Win32 build-depends: Win32 common text - if impl(ghc == 8.10.7)&& os(darwin)&& arch(aarch64) + if impl(ghc ==8.10.7) && os(osx) && arch(aarch64) build-depends: text >=1.2.5.0 else build-depends: text >=2.0 @@ -192,6 +192,7 @@ library internal iproute, memory, microlens, + microlens-aeson, mtl, network, optparse-applicative-fork, @@ -313,11 +314,13 @@ test-suite cardano-api-test cardano-crypto-class ^>=2.1.2, cardano-crypto-test ^>=1.5, cardano-crypto-tests ^>=2.1, + cardano-ledger-alonzo, cardano-ledger-api ^>=1.9, cardano-ledger-binary, cardano-ledger-core:{cardano-ledger-core, testlib} >=1.8, cardano-protocol-tpraos, cardano-slotting, + cborg, containers, directory, hedgehog >=1.1, @@ -329,6 +332,7 @@ test-suite cardano-api-test ouroboros-consensus-cardano, ouroboros-consensus-protocol, ouroboros-network-api, + plutus-ledger-api, tasty, tasty-hedgehog, tasty-quickcheck, @@ -338,6 +342,7 @@ test-suite cardano-api-test Test.Cardano.Api.Crypto Test.Cardano.Api.EpochLeadership Test.Cardano.Api.Eras + Test.Cardano.Api.Genesis Test.Cardano.Api.IO Test.Cardano.Api.Json Test.Cardano.Api.KeysByron diff --git a/cardano-api/internal/Cardano/Api/Genesis.hs b/cardano-api/internal/Cardano/Api/Genesis.hs index 598cf426fb..3f6ff7e34c 100644 --- a/cardano-api/internal/Cardano/Api/Genesis.hs +++ b/cardano-api/internal/Cardano/Api/Genesis.hs @@ -1,10 +1,18 @@ {-# LANGUAGE DerivingStrategies #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE GADTs #-} {-# LANGUAGE GeneralisedNewtypeDeriving #-} +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TupleSections #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} module Cardano.Api.Genesis ( ShelleyGenesis (..) , shelleyGenesisDefaults , alonzoGenesisDefaults + , decodeAlonzoGenesis , conwayGenesisDefaults -- ** Configuration @@ -26,7 +34,10 @@ module Cardano.Api.Genesis ) where +import Cardano.Api.Eon.ConwayEraOnwards +import Cardano.Api.Eras.Core import Cardano.Api.IO +import Cardano.Api.Monad.Error import Cardano.Api.Utils (unsafeBoundedRational) import qualified Cardano.Chain.Genesis import qualified Cardano.Crypto.Hash.Blake2b @@ -44,6 +55,7 @@ import Cardano.Ledger.Conway.PParams ) import Cardano.Ledger.Crypto (StandardCrypto) import Cardano.Ledger.Plutus (Language (..)) +import qualified Cardano.Ledger.Plutus as L import Cardano.Ledger.Plutus.CostModels (mkCostModelsLenient) import Cardano.Ledger.Shelley.Core import Cardano.Ledger.Shelley.Genesis @@ -52,19 +64,31 @@ import Cardano.Ledger.Shelley.Genesis , emptyGenesisStaking ) import qualified Cardano.Ledger.Shelley.Genesis as Ledger +import Control.Monad import Control.Monad.Trans.Fail.String (errorFail) +import qualified Data.Aeson as A import Data.ByteString (ByteString) +import qualified Data.ByteString.Lazy as LBS import qualified Data.Default.Class as DefaultClass import Data.Functor.Identity (Identity) +import Data.Int (Int64) +import Data.List (sortOn) import qualified Data.ListMap as ListMap -import qualified Data.Map.Strict as Map +import Data.Map (Map) +import qualified Data.Map.Strict as M +import Data.Maybe import Data.Ratio +import qualified Data.Set as S import Data.Text (Text) import qualified Data.Time as Time import Data.Typeable +import qualified Data.Vector as V +import GHC.Exts (IsList (..)) import GHC.Stack (HasCallStack) import Lens.Micro +import qualified Lens.Micro.Aeson as AL import qualified Ouroboros.Consensus.Shelley.Eras as Shelley +import qualified PlutusLedgerApi.V2 as V2 import Test.Cardano.Ledger.Core.Rational ((%!)) import Test.Cardano.Ledger.Plutus (testingCostModelV3) @@ -151,7 +175,7 @@ shelleyGenesisDefaults = & ppRhoL .~ unsafeBR (1 % 10) -- How much of reserves goes into pot & ppTauL .~ unsafeBR (1 % 10) -- τ * remaining_reserves is sent to treasury every epoch , -- genesis keys and initial funds - sgGenDelegs = Map.empty + sgGenDelegs = M.empty , sgStaking = emptyGenesisStaking , sgInitialFunds = ListMap.empty , sgMaxLovelaceSupply = 0 @@ -163,7 +187,7 @@ shelleyGenesisDefaults = unsafeBR = unsafeBoundedRational -- | Some reasonable starting defaults for constructing a 'ConwayGenesis'. --- | Based on https://github.com/IntersectMBO/cardano-node/blob/master/cardano-testnet/src/Testnet/Defaults.hs +-- Based on https://github.com/IntersectMBO/cardano-node/blob/master/cardano-testnet/src/Testnet/Defaults.hs conwayGenesisDefaults :: ConwayGenesis StandardCrypto conwayGenesisDefaults = ConwayGenesis @@ -214,8 +238,109 @@ conwayGenesisDefaults = , dvtCommitteeNoConfidence = 0 %! 1 } +-- | Decode Alonzo genesis in an optionally era sensitive way. +-- +-- Because the Plutus V2 cost model has changed between Babbage and Conway era, we need to know the era if we +-- want to decde Alonzo Genesis with a cost model baked in. If the V2 cost model is present in genesis, you +-- need to provide an era witness. +-- +-- When an era witness is provided, for Plutus V2 model the function additionally: +-- 1. Does extra cost model parameters name validation: Checks for mandatory 175 parameters if provided in +-- a map form. +-- 2. If >= Conway: adds defaults for new 10 parameters, if they were not provided (maxBound) +-- 3. Removes extra parameters above the max count: Babbage - 175, Conway - 185. +decodeAlonzoGenesis + :: forall era t m + . MonadTransError String t m + => Maybe (CardanoEra era) + -- ^ An optional era witness in which we're reading the genesis + -> LBS.ByteString + -- ^ Genesis JSON + -> t m AlonzoGenesis +decodeAlonzoGenesis Nothing genesisBs = + modifyError ("Cannot decode Alonzo genesis: " <>) $ + liftEither $ + A.eitherDecode genesisBs +decodeAlonzoGenesis (Just era) genesisBs = modifyError ("Cannot decode era-sensitive Alonzo genesis: " <>) $ do + genesisValue :: A.Value <- liftEither $ A.eitherDecode genesisBs + -- Making a fixup of a costmodel is easier before JSON deserialization. This also saves us from building + -- plutus' EvaluationContext one more time after cost model update. + genesisValue' <- + (AL.key "costModels" . AL.key "PlutusV2" . AL._Value) setCostModelDefaultValues genesisValue + fromJsonE genesisValue' + where + setCostModelDefaultValues :: A.Value -> ExceptT String m A.Value + setCostModelDefaultValues = \case + obj@(A.Object _) -> do + -- decode cost model into a map first + costModel :: Map V2.ParamName Int64 <- + modifyError ("Decoding cost model object: " <>) $ fromJsonE obj + + let costModelWithDefaults = + sortOn fst + . toList + $ M.union costModel optionalCostModelDefaultValues + + -- check that we have all required params + unless (allCostModelParams == (fst <$> costModelWithDefaults)) $ do + let allCostModelParamsSet = fromList allCostModelParams + providedCostModelParamsSet = fromList $ fst <$> costModelWithDefaults + throwError $ + "Missing V2 Plutus cost model parameters: " + <> show (toList $ S.difference allCostModelParamsSet providedCostModelParamsSet) + + -- We have already have required params, we already added optional ones (which are trimmed later + -- if required). Continue processing further in array representation. + setCostModelDefaultValues . A.toJSON $ map snd costModelWithDefaults + A.Array vec + -- here we rely on an assumption that params are in correct order, so that we can take only the + -- required ones for an era + | V.length vec < costModelExpectedCount -> + pure . A.Array . V.take costModelExpectedCount $ + vec <> (A.toJSON . snd <$> optionalCostModelDefaultValues) + | V.length vec > costModelExpectedCount -> pure . A.Array $ V.take costModelExpectedCount vec + other -> pure other + + -- Plutus V2 params expected count depending on an era + costModelExpectedCount :: Int + costModelExpectedCount + -- use all available parameters >= conway + | isConwayOnwards = length allCostModelParams + -- use only required params in < conway + | otherwise = L.costModelParamsCount L.PlutusV2 -- Babbage + + -- A list-like of tuples (param name, value) with default maxBound value + optionalCostModelDefaultValues :: (Item l ~ (V2.ParamName, Int64), IsList l) => l + optionalCostModelDefaultValues = fromList $ map (,maxBound) optionalV2costModelParams + + allCostModelParams :: [V2.ParamName] + allCostModelParams = [minBound .. maxBound] + + -- The new V2 cost model params introduced in Conway + optionalV2costModelParams :: [V2.ParamName] + optionalV2costModelParams = + [ V2.IntegerToByteString'cpu'arguments'c0 + , V2.IntegerToByteString'cpu'arguments'c1 + , V2.IntegerToByteString'cpu'arguments'c2 + , V2.IntegerToByteString'memory'arguments'intercept + , V2.IntegerToByteString'memory'arguments'slope + , V2.ByteStringToInteger'cpu'arguments'c0 + , V2.ByteStringToInteger'cpu'arguments'c1 + , V2.ByteStringToInteger'cpu'arguments'c2 + , V2.ByteStringToInteger'memory'arguments'intercept + , V2.ByteStringToInteger'memory'arguments'slope + ] + + fromJsonE :: A.FromJSON a => A.Value -> ExceptT String m a + fromJsonE v = + case A.fromJSON v of + A.Success a -> pure a + A.Error e -> throwError e + + isConwayOnwards = isJust $ forEraMaybeEon @ConwayEraOnwards era + -- | Some reasonable starting defaults for constructing a 'AlonzoGenesis'. --- | Based on https://github.com/IntersectMBO/cardano-node/blob/master/cardano-testnet/src/Testnet/Defaults.hs +-- Based on https://github.com/IntersectMBO/cardano-node/blob/master/cardano-testnet/src/Testnet/Defaults.hs alonzoGenesisDefaults :: AlonzoGenesis alonzoGenesisDefaults = AlonzoGenesis @@ -243,7 +368,7 @@ alonzoGenesisDefaults = where apiCostModels = mkCostModelsLenient $ - Map.fromList + fromList [ (fromIntegral $ fromEnum PlutusV1, defaultV1CostModel) , (fromIntegral $ fromEnum PlutusV2, defaultV2CostModel) ] @@ -592,4 +717,15 @@ alonzoGenesisDefaults = , 38887044 , 32947 , 10 + , -- New Conway costmodel parameters below + 1292075 + , 24469 + , 74 + , 0 + , 1 + , 936157 + , 49601 + , 237 + , 0 + , 1 ] diff --git a/cardano-api/internal/Cardano/Api/LedgerState.hs b/cardano-api/internal/Cardano/Api/LedgerState.hs index fcfff007aa..07eea2b58e 100644 --- a/cardano-api/internal/Cardano/Api/LedgerState.hs +++ b/cardano-api/internal/Cardano/Api/LedgerState.hs @@ -98,7 +98,7 @@ import Cardano.Api.Block import Cardano.Api.Certificate import Cardano.Api.Eon.ShelleyBasedEra import Cardano.Api.Eras.Case -import Cardano.Api.Eras.Core (forEraMaybeEon) +import Cardano.Api.Eras.Core (CardanoEra, forEraMaybeEon) import Cardano.Api.Error as Api import Cardano.Api.Genesis import Cardano.Api.IO @@ -183,7 +183,7 @@ import qualified Data.ByteArray import Data.ByteString (ByteString) import qualified Data.ByteString as BS import qualified Data.ByteString.Base16 as Base16 -import qualified Data.ByteString.Lazy as LB +import qualified Data.ByteString.Lazy as LBS import Data.ByteString.Short as BSS import Data.Foldable import Data.IORef @@ -321,7 +321,7 @@ initialLedgerState nodeConfigFile = do -- can remove the nodeConfigFile argument and much of the code in this -- module. config <- modifyError ILSEConfigFile (readNodeConfig nodeConfigFile) - genesisConfig <- modifyError ILSEGenesisFile (readCardanoGenesisConfig config) + genesisConfig <- modifyError ILSEGenesisFile (readCardanoGenesisConfig Nothing config) env <- modifyError ILSELedgerConsensusConfig (except (genesisConfigToEnv genesisConfig)) let ledgerState = initLedgerStateVar genesisConfig return (env, ledgerState) @@ -1357,12 +1357,13 @@ shelleyPraosNonce genesisHash = readCardanoGenesisConfig :: MonadIOTransError GenesisConfigError t m - => NodeConfig + => Maybe (CardanoEra era) + -> NodeConfig -> t m GenesisConfig -readCardanoGenesisConfig enc = do +readCardanoGenesisConfig mEra enc = do byronGenesis <- readByronGenesisConfig enc ShelleyConfig shelleyGenesis shelleyGenesisHash <- readShelleyGenesisConfig enc - alonzoGenesis <- readAlonzoGenesisConfig enc + alonzoGenesis <- readAlonzoGenesisConfig mEra enc conwayGenesis <- readConwayGenesisConfig enc let transCfg = Ledger.mkLatestTransitionConfig shelleyGenesis alonzoGenesis conwayGenesis pure $ GenesisCardano enc byronGenesis shelleyGenesisHash transCfg @@ -1440,12 +1441,13 @@ readShelleyGenesisConfig enc = do readAlonzoGenesisConfig :: MonadIOTransError GenesisConfigError t m - => NodeConfig + => Maybe (CardanoEra era) + -> NodeConfig -> t m AlonzoGenesis -readAlonzoGenesisConfig enc = do +readAlonzoGenesisConfig mEra enc = do let file = ncAlonzoGenesisFile enc modifyError (NEAlonzoConfig (unFile file) . renderAlonzoGenesisError) $ - readAlonzoGenesis file (ncAlonzoGenesisHash enc) + readAlonzoGenesis mEra file (ncAlonzoGenesisHash enc) -- | If the conway genesis file does not exist we simply put in a default. readConwayGenesisConfig @@ -1518,17 +1520,19 @@ renderShelleyGenesisError sge = ] readAlonzoGenesis - :: forall m t + :: forall m t era . MonadIOTransError AlonzoGenesisError t m - => File AlonzoGenesis 'In + => Maybe (CardanoEra era) + -> File AlonzoGenesis 'In -> GenesisHashAlonzo -> t m AlonzoGenesis -readAlonzoGenesis (File file) expectedGenesisHash = do +readAlonzoGenesis mEra (File file) expectedGenesisHash = do content <- - modifyError id $ handleIOExceptT (AlonzoGenesisReadError file . textShow) $ BS.readFile file - let genesisHash = GenesisHashAlonzo (Cardano.Crypto.Hash.Class.hashWith id content) + modifyError id $ handleIOExceptT (AlonzoGenesisReadError file . textShow) $ LBS.readFile file + let genesisHash = GenesisHashAlonzo . Cardano.Crypto.Hash.Class.hashWith id $ LBS.toStrict content checkExpectedGenesisHash genesisHash - liftEither . first (AlonzoGenesisDecodeError file . Text.pack) $ Aeson.eitherDecodeStrict' content + modifyError (AlonzoGenesisDecodeError file . Text.pack) $ + decodeAlonzoGenesis mEra content where checkExpectedGenesisHash :: GenesisHashAlonzo -> t m () checkExpectedGenesisHash actual = @@ -1641,8 +1645,7 @@ renderHash :: Cardano.Crypto.Hash.Class.Hash Cardano.Crypto.Hash.Blake2b.Blake2b_256 ByteString -> Text renderHash h = Text.decodeUtf8 $ Base16.encode (Cardano.Crypto.Hash.Class.hashToBytes h) -newtype StakeCred - = StakeCred {_unStakeCred :: Ledger.Credential 'Ledger.Staking Consensus.StandardCrypto} +newtype StakeCred = StakeCred {_unStakeCred :: Ledger.Credential 'Ledger.Staking Consensus.StandardCrypto} deriving (Eq, Ord) data Env = Env @@ -1755,7 +1758,7 @@ unChainHash ch = data LeadershipError = LeaderErrDecodeLedgerStateFailure - | LeaderErrDecodeProtocolStateFailure (LB.ByteString, DecoderError) + | LeaderErrDecodeProtocolStateFailure (LBS.ByteString, DecoderError) | LeaderErrDecodeProtocolEpochStateFailure DecoderError | LeaderErrGenesisSlot | LeaderErrStakePoolHasNoStake PoolId @@ -1932,7 +1935,8 @@ isLeadingSlotsTPraos slotRangeOfInterest poolid snapshotPoolDistr eNonce vrfSkey let certifiedVrf s = Crypto.evalCertified () (TPraos.mkSeed TPraos.seedL s eNonce) vrfSkey stakePoolStake <- - ShelleyAPI.individualPoolStake <$> Map.lookup poolHash snapshotPoolDistr + ShelleyAPI.individualPoolStake + <$> Map.lookup poolHash snapshotPoolDistr & note (LeaderErrStakePoolHasNoStake poolid) let isLeader s = TPraos.checkLeaderValue (Crypto.certifiedOutput (certifiedVrf s)) stakePoolStake activeSlotCoeff' diff --git a/cardano-api/internal/Cardano/Api/Orphans.hs b/cardano-api/internal/Cardano/Api/Orphans.hs index 2df04691d1..9806c38c5d 100644 --- a/cardano-api/internal/Cardano/Api/Orphans.hs +++ b/cardano-api/internal/Cardano/Api/Orphans.hs @@ -65,6 +65,7 @@ import qualified Cardano.Protocol.TPraos.Rules.Tickn as Ledger import qualified Codec.Binary.Bech32 as Bech32 import qualified Codec.CBOR.Read as CBOR import Data.Aeson (KeyValue ((.=)), ToJSON (..), ToJSONKey (..), object, pairs) +import qualified Data.Aeson as A import qualified Data.Aeson as Aeson import qualified Data.ByteString.Base16 as Base16 import qualified Data.ByteString.Short as SBS @@ -72,6 +73,7 @@ import Data.Data (Data) import Data.Kind (Constraint, Type) import Data.Maybe.Strict (StrictMaybe (..)) import Data.Monoid +import qualified Data.Text as T import qualified Data.Text.Encoding as Text import Data.Typeable (Typeable) import GHC.Generics @@ -89,6 +91,8 @@ import Ouroboros.Consensus.Shelley.Ledger.Block (ShelleyHash (..)) import qualified Ouroboros.Consensus.Shelley.Ledger.Query as Consensus import Ouroboros.Network.Block (HeaderHash, Tip (..)) import Ouroboros.Network.Mux (MuxError) +import qualified PlutusLedgerApi.Common as P +import qualified PlutusLedgerApi.V2 as V2 deriving instance Generic (L.ApplyTxError era) @@ -551,3 +555,17 @@ lastMappendWithTHKD f a b = Ledger.THKD $ lastMappendWith (Ledger.unTHKD . f) a instance Pretty MuxError where pretty err = "Mux layer error:" <+> prettyException err + +instance A.FromJSON V2.ParamName where + parseJSON = A.withText "ParamName" parsePlutusParamName + +instance A.FromJSONKey V2.ParamName where + fromJSONKey = A.FromJSONKeyTextParser parsePlutusParamName + +parsePlutusParamName :: (P.IsParamName a, MonadFail f) => T.Text -> f a +parsePlutusParamName t = + case P.readParamName t of + Just p -> pure p + Nothing -> fail $ "Cannot parse cost model parameter name: " <> T.unpack t + +deriving instance Show V2.ParamName diff --git a/cardano-api/src/Cardano/Api/Shelley.hs b/cardano-api/src/Cardano/Api/Shelley.hs index f1f475b79e..c97ecaa883 100644 --- a/cardano-api/src/Cardano/Api/Shelley.hs +++ b/cardano-api/src/Cardano/Api/Shelley.hs @@ -8,6 +8,7 @@ module Cardano.Api.Shelley , ShelleyGenesis (..) , shelleyGenesisDefaults , alonzoGenesisDefaults + , decodeAlonzoGenesis , conwayGenesisDefaults -- * Cryptographic key interface diff --git a/cardano-api/test/cardano-api-test/Test/Cardano/Api/Genesis.hs b/cardano-api/test/cardano-api-test/Test/Cardano/Api/Genesis.hs new file mode 100644 index 0000000000..ad43a2db87 --- /dev/null +++ b/cardano-api/test/cardano-api-test/Test/Cardano/Api/Genesis.hs @@ -0,0 +1,198 @@ +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TupleSections #-} +{-# LANGUAGE TypeApplications #-} + +module Test.Cardano.Api.Genesis + ( tests + ) +where + +import Cardano.Api.Eon.ShelleyBasedEra +import Cardano.Api.Eras +import Cardano.Api.Genesis +import qualified Cardano.Api.Ledger as L +import Cardano.Api.Shelley +import qualified Cardano.Binary as CB +import qualified Cardano.Ledger.Alonzo.Genesis as L +import qualified Cardano.Ledger.Binary as L +import qualified Cardano.Ledger.Plutus as L +import qualified Codec.CBOR.Decoding as CBOR +import qualified Codec.CBOR.Encoding as CBOR +import qualified Codec.CBOR.Write as CBOR +import qualified Data.ByteString.Lazy as LBS +import Data.Either +import Data.Int (Int64) +import qualified Data.Map.Strict as M +import Data.Maybe +import GHC.Stack +import Hedgehog as H +import qualified Hedgehog.Extras as H +import qualified PlutusLedgerApi.V2 as V2 +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.Hedgehog (testProperty) + +-- TODO add comment explaining what's happening here + +prop_reading_plutus_v2_era_sensitive_costmodel + :: forall era + . IsCardanoEra era + => CardanoEra era + -> PlutusV2CostModelFormat + -> Property +prop_reading_plutus_v2_era_sensitive_costmodel era cmf = H.propertyOnce $ do + H.noteShow_ $ "Era: " <> pshow era + H.noteShow_ $ "Cost model type: " <> show cmf + (allCostModels, v2costModelValues) <- + H.leftFailM $ loadPlutusV2CostModelFromGenesis (Just era) (getGenesisFile cmf) + + H.noteShow_ v2costModelValues + + let isConwayOnwards = isJust $ maybeEon @ConwayEraOnwards @era + last10CostModelValues = reverse . take 10 $ reverse v2costModelValues + -- values from @perturbing + last10CostModelCorrectValues = [1292075, 24469, 74, 0, 1, 936157, 49601, 237, 0, 1] + + if isConwayOnwards + then do + length v2costModelValues === 185 + if getCostModelFileParamCount cmf < 185 + then last10CostModelValues === replicate 10 maxBound + else last10CostModelValues === last10CostModelCorrectValues + else length v2costModelValues === 175 + + aeo <- H.nothingFail $ maybeEon @AlonzoEraOnwards @era + let allCostModelsBs = encodeCborInEraCostModels aeo allCostModels + allCostModels' <- H.leftFail $ decodeCborInEraCostModels aeo allCostModelsBs + allCostModels' === allCostModels + +prop_reading_plutus_v2_costmodel + :: PlutusV2CostModelFormat + -> Property +prop_reading_plutus_v2_costmodel cmf = H.propertyOnce $ do + H.noteShow_ $ "Cost model type: " <> show cmf + mCostModelValues <- fmap snd <$> loadPlutusV2CostModelFromGenesis Nothing (getGenesisFile cmf) + + H.noteShow_ mCostModelValues + + if cmf == Map175 + then do + H.assertWith mCostModelValues isLeft + else do + costModelValues <- H.leftFail mCostModelValues + length costModelValues === getCostModelFileParamCount cmf + +prop_verify_plutus_v2_costmodel :: Property +prop_verify_plutus_v2_costmodel = H.propertyOnce $ do + let lastParamName = maxBound + last10Params = (toEnum . subtract 9 $ fromEnum lastParamName) `enumFromTo` lastParamName :: [V2.ParamName] + H.note_ "Check that last 10 params of PlutusV2 cost models are exactly the ones we expect" + -- The conditional logic of trimming conway parameters in babbage relies on the fact that last 10 V2 params + -- are those below + last10Params + === [ V2.IntegerToByteString'cpu'arguments'c0 + , V2.IntegerToByteString'cpu'arguments'c1 + , V2.IntegerToByteString'cpu'arguments'c2 + , V2.IntegerToByteString'memory'arguments'intercept + , V2.IntegerToByteString'memory'arguments'slope + , V2.ByteStringToInteger'cpu'arguments'c0 + , V2.ByteStringToInteger'cpu'arguments'c1 + , V2.ByteStringToInteger'cpu'arguments'c2 + , V2.ByteStringToInteger'memory'arguments'intercept + , V2.ByteStringToInteger'memory'arguments'slope + ] + +-- * Utilities + +data PlutusV2CostModelFormat + = Map175 + | Map185 + | Array175 + | Array185 + deriving (Eq, Show) + +getGenesisFile :: PlutusV2CostModelFormat -> FilePath +getGenesisFile = + ("./test/cardano-api-test/files/input/genesis/spec.alonzo-v2-cost-model-" <>) . \case + Map175 -> "map-175.json" + Map185 -> "map-185.json" + Array175 -> "array-175.json" + Array185 -> "array-185.json" + +getCostModelFileParamCount :: PlutusV2CostModelFormat -> Int +getCostModelFileParamCount = \case + Map175 -> 175 + Map185 -> 185 + Array175 -> 175 + Array185 -> 185 + +loadPlutusV2CostModelFromGenesis + :: HasCallStack + => MonadIO m + => MonadTest m + => Maybe (CardanoEra era) + -> FilePath + -> m (Either String (L.CostModels, [Int64])) +loadPlutusV2CostModelFromGenesis mEra filePath = withFrozenCallStack . runExceptT $ do + genesisBs <- H.lbsReadFile filePath + costModels <- modifyError show $ L.agCostModels <$> decodeAlonzoGenesis mEra genesisBs + liftEither + . fmap ((costModels,) . L.getCostModelParams) + . maybe (Left "No PlutusV2 model found") Right + . M.lookup L.PlutusV2 + $ L.costModelsValid costModels + +decodeCborInEraCostModels + :: forall era + . AlonzoEraOnwards era + -> LBS.ByteString + -> Either L.DecoderError L.CostModels +decodeCborInEraCostModels aeo = CB.decodeFullDecoder "AlonzoGenesis" fromEraCbor' + where + fromEraCbor' :: CBOR.Decoder s L.CostModels + fromEraCbor' = alonzoEraOnwardsConstraints aeo $ L.fromEraCBOR @(ShelleyLedgerEra era) + +encodeCborInEraCostModels + :: forall era + . AlonzoEraOnwards era + -> L.CostModels + -> LBS.ByteString +encodeCborInEraCostModels aeo = CBOR.toLazyByteString . toEraCbor' + where + toEraCbor' :: L.CostModels -> CBOR.Encoding + toEraCbor' = alonzoEraOnwardsConstraints aeo $ L.toEraCBOR @(ShelleyLedgerEra era) + +-- * List all test cases + +tests :: TestTree +tests = + testGroup + "Test.Cardano.Api.Genesis" + [ testProperty "Read Alonzo genesis with PlutusV2 cost model map with 175 params - Babbage" $ + prop_reading_plutus_v2_era_sensitive_costmodel BabbageEra Map175 + , testProperty "Read Alonzo genesis with PlutusV2 cost model map with 175 params - Conway" $ + prop_reading_plutus_v2_era_sensitive_costmodel ConwayEra Map175 + , testProperty "Read Alonzo genesis with PlutusV2 cost model map with 175 params - era insensitive" $ + prop_reading_plutus_v2_costmodel Map175 + , testProperty "Read Alonzo genesis with PlutusV2 cost model map with 185 params - Babbage" $ + prop_reading_plutus_v2_era_sensitive_costmodel BabbageEra Map185 + , testProperty "Read Alonzo genesis with PlutusV2 cost model map with 185 params - Conway" $ + prop_reading_plutus_v2_era_sensitive_costmodel ConwayEra Map185 + , testProperty "Read Alonzo genesis with PlutusV2 cost model map with 185 params - era insensitive" $ + prop_reading_plutus_v2_costmodel Map185 + , testProperty "Read Alonzo genesis with PlutusV2 cost model array with 175 params - Babbage" $ + prop_reading_plutus_v2_era_sensitive_costmodel BabbageEra Array175 + , testProperty "Read Alonzo genesis with PlutusV2 cost model array with 175 params - Conway" $ + prop_reading_plutus_v2_era_sensitive_costmodel ConwayEra Array175 + , testProperty "Read Alonzo genesis with PlutusV2 cost model array with 175 params - era insensitive" $ + prop_reading_plutus_v2_costmodel Array175 + , testProperty "Read Alonzo genesis with PlutusV2 cost model array with 185 params - Babbage" $ + prop_reading_plutus_v2_era_sensitive_costmodel BabbageEra Array185 + , testProperty "Read Alonzo genesis with PlutusV2 cost model array with 185 params - Conway" $ + prop_reading_plutus_v2_era_sensitive_costmodel ConwayEra Array185 + , testProperty "Read Alonzo genesis with PlutusV2 cost model array with 185 params - era insensitive" $ + prop_reading_plutus_v2_costmodel Array185 + , testProperty + "Make sure that last 10 PlutusV2 cost model parameters are the ones we expect" + prop_verify_plutus_v2_costmodel + ] diff --git a/cardano-api/test/cardano-api-test/cardano-api-test.hs b/cardano-api/test/cardano-api-test/cardano-api-test.hs index 40511e5448..396928a529 100644 --- a/cardano-api/test/cardano-api-test/cardano-api-test.hs +++ b/cardano-api/test/cardano-api-test/cardano-api-test.hs @@ -5,6 +5,7 @@ import System.IO (BufferMode (LineBuffering), hSetBuffering, hSetEncoding, stdou import qualified Test.Cardano.Api.Crypto import qualified Test.Cardano.Api.EpochLeadership import qualified Test.Cardano.Api.Eras +import qualified Test.Cardano.Api.Genesis import qualified Test.Cardano.Api.IO import qualified Test.Cardano.Api.Json import qualified Test.Cardano.Api.KeysByron @@ -39,6 +40,7 @@ tests = , Test.Cardano.Api.Crypto.tests , Test.Cardano.Api.EpochLeadership.tests , Test.Cardano.Api.Eras.tests + , Test.Cardano.Api.Genesis.tests , Test.Cardano.Api.IO.tests , Test.Cardano.Api.Json.tests , Test.Cardano.Api.KeysByron.tests diff --git a/cardano-api/test/cardano-api-test/files/input/genesis/spec.alonzo-v2-cost-model-array-175.json b/cardano-api/test/cardano-api-test/files/input/genesis/spec.alonzo-v2-cost-model-array-175.json new file mode 100644 index 0000000000..abcaab932f --- /dev/null +++ b/cardano-api/test/cardano-api-test/files/input/genesis/spec.alonzo-v2-cost-model-array-175.json @@ -0,0 +1,365 @@ +{ + "collateralPercentage": 150, + "costModels": { + "PlutusV1": [ + 205665, + 812, + 1, + 1, + 1000, + 571, + 0, + 1, + 1000, + 24177, + 4, + 1, + 1000, + 32, + 117366, + 10475, + 4, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 100, + 100, + 23000, + 100, + 19537, + 32, + 175354, + 32, + 46417, + 4, + 221973, + 511, + 0, + 1, + 89141, + 32, + 497525, + 14068, + 4, + 2, + 196500, + 453240, + 220, + 0, + 1, + 1, + 1000, + 28662, + 4, + 2, + 245000, + 216773, + 62, + 1, + 1060367, + 12586, + 1, + 208512, + 421, + 1, + 187000, + 1000, + 52998, + 1, + 80436, + 32, + 43249, + 32, + 1000, + 32, + 80556, + 1, + 57667, + 4, + 1000, + 10, + 197145, + 156, + 1, + 197145, + 156, + 1, + 204924, + 473, + 1, + 208896, + 511, + 1, + 52467, + 32, + 64832, + 32, + 65493, + 32, + 22558, + 32, + 16563, + 32, + 76511, + 32, + 196500, + 453240, + 220, + 0, + 1, + 1, + 69522, + 11687, + 0, + 1, + 60091, + 32, + 196500, + 453240, + 220, + 0, + 1, + 1, + 196500, + 453240, + 220, + 0, + 1, + 1, + 806990, + 30482, + 4, + 1927926, + 82523, + 4, + 265318, + 0, + 4, + 0, + 85931, + 32, + 205665, + 812, + 1, + 1, + 41182, + 32, + 212342, + 32, + 31220, + 32, + 32696, + 32, + 43357, + 32, + 32247, + 32, + 38314, + 32, + 9462713, + 1021, + 10 + ], + "PlutusV2": [ + 205665, + 812, + 1, + 1, + 1000, + 571, + 0, + 1, + 1000, + 24177, + 4, + 1, + 1000, + 32, + 117366, + 10475, + 4, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 100, + 100, + 23000, + 100, + 19537, + 32, + 175354, + 32, + 46417, + 4, + 221973, + 511, + 0, + 1, + 89141, + 32, + 497525, + 14068, + 4, + 2, + 196500, + 453240, + 220, + 0, + 1, + 1, + 1000, + 28662, + 4, + 2, + 245000, + 216773, + 62, + 1, + 1060367, + 12586, + 1, + 208512, + 421, + 1, + 187000, + 1000, + 52998, + 1, + 80436, + 32, + 43249, + 32, + 1000, + 32, + 80556, + 1, + 57667, + 4, + 1000, + 10, + 197145, + 156, + 1, + 197145, + 156, + 1, + 204924, + 473, + 1, + 208896, + 511, + 1, + 52467, + 32, + 64832, + 32, + 65493, + 32, + 22558, + 32, + 16563, + 32, + 76511, + 32, + 196500, + 453240, + 220, + 0, + 1, + 1, + 69522, + 11687, + 0, + 1, + 60091, + 32, + 196500, + 453240, + 220, + 0, + 1, + 1, + 196500, + 453240, + 220, + 0, + 1, + 1, + 1159724, + 392670, + 0, + 2, + 806990, + 30482, + 4, + 1927926, + 82523, + 4, + 265318, + 0, + 4, + 0, + 85931, + 32, + 205665, + 812, + 1, + 1, + 41182, + 32, + 212342, + 32, + 31220, + 32, + 32696, + 32, + 43357, + 32, + 32247, + 32, + 38314, + 32, + 35892428, + 10, + 9462713, + 1021, + 10, + 38887044, + 32947, + 10 + ] + }, + "executionPrices": { + "prMem": 0.0577, + "prSteps": 7.21e-05 + }, + "lovelacePerUTxOWord": 34482, + "maxBlockExUnits": { + "exUnitsMem": 62000000, + "exUnitsSteps": 40000000000 + }, + "maxCollateralInputs": 3, + "maxTxExUnits": { + "exUnitsMem": 14000000, + "exUnitsSteps": 10000000000 + }, + "maxValueSize": 5000 +} diff --git a/cardano-api/test/cardano-api-test/files/input/genesis/spec.alonzo-v2-cost-model-array-185.json b/cardano-api/test/cardano-api-test/files/input/genesis/spec.alonzo-v2-cost-model-array-185.json new file mode 100644 index 0000000000..2b5ae7754a --- /dev/null +++ b/cardano-api/test/cardano-api-test/files/input/genesis/spec.alonzo-v2-cost-model-array-185.json @@ -0,0 +1,375 @@ +{ + "collateralPercentage": 150, + "costModels": { + "PlutusV1": [ + 205665, + 812, + 1, + 1, + 1000, + 571, + 0, + 1, + 1000, + 24177, + 4, + 1, + 1000, + 32, + 117366, + 10475, + 4, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 100, + 100, + 23000, + 100, + 19537, + 32, + 175354, + 32, + 46417, + 4, + 221973, + 511, + 0, + 1, + 89141, + 32, + 497525, + 14068, + 4, + 2, + 196500, + 453240, + 220, + 0, + 1, + 1, + 1000, + 28662, + 4, + 2, + 245000, + 216773, + 62, + 1, + 1060367, + 12586, + 1, + 208512, + 421, + 1, + 187000, + 1000, + 52998, + 1, + 80436, + 32, + 43249, + 32, + 1000, + 32, + 80556, + 1, + 57667, + 4, + 1000, + 10, + 197145, + 156, + 1, + 197145, + 156, + 1, + 204924, + 473, + 1, + 208896, + 511, + 1, + 52467, + 32, + 64832, + 32, + 65493, + 32, + 22558, + 32, + 16563, + 32, + 76511, + 32, + 196500, + 453240, + 220, + 0, + 1, + 1, + 69522, + 11687, + 0, + 1, + 60091, + 32, + 196500, + 453240, + 220, + 0, + 1, + 1, + 196500, + 453240, + 220, + 0, + 1, + 1, + 806990, + 30482, + 4, + 1927926, + 82523, + 4, + 265318, + 0, + 4, + 0, + 85931, + 32, + 205665, + 812, + 1, + 1, + 41182, + 32, + 212342, + 32, + 31220, + 32, + 32696, + 32, + 43357, + 32, + 32247, + 32, + 38314, + 32, + 9462713, + 1021, + 10 + ], + "PlutusV2": [ + 205665, + 812, + 1, + 1, + 1000, + 571, + 0, + 1, + 1000, + 24177, + 4, + 1, + 1000, + 32, + 117366, + 10475, + 4, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 23000, + 100, + 100, + 100, + 23000, + 100, + 19537, + 32, + 175354, + 32, + 46417, + 4, + 221973, + 511, + 0, + 1, + 89141, + 32, + 497525, + 14068, + 4, + 2, + 196500, + 453240, + 220, + 0, + 1, + 1, + 1000, + 28662, + 4, + 2, + 245000, + 216773, + 62, + 1, + 1060367, + 12586, + 1, + 208512, + 421, + 1, + 187000, + 1000, + 52998, + 1, + 80436, + 32, + 43249, + 32, + 1000, + 32, + 80556, + 1, + 57667, + 4, + 1000, + 10, + 197145, + 156, + 1, + 197145, + 156, + 1, + 204924, + 473, + 1, + 208896, + 511, + 1, + 52467, + 32, + 64832, + 32, + 65493, + 32, + 22558, + 32, + 16563, + 32, + 76511, + 32, + 196500, + 453240, + 220, + 0, + 1, + 1, + 69522, + 11687, + 0, + 1, + 60091, + 32, + 196500, + 453240, + 220, + 0, + 1, + 1, + 196500, + 453240, + 220, + 0, + 1, + 1, + 1159724, + 392670, + 0, + 2, + 806990, + 30482, + 4, + 1927926, + 82523, + 4, + 265318, + 0, + 4, + 0, + 85931, + 32, + 205665, + 812, + 1, + 1, + 41182, + 32, + 212342, + 32, + 31220, + 32, + 32696, + 32, + 43357, + 32, + 32247, + 32, + 38314, + 32, + 35892428, + 10, + 9462713, + 1021, + 10, + 38887044, + 32947, + 10, + 1292075, + 24469, + 74, + 0, + 1, + 936157, + 49601, + 237, + 0, + 1 + ] + }, + "executionPrices": { + "prMem": 0.0577, + "prSteps": 7.21e-05 + }, + "lovelacePerUTxOWord": 34482, + "maxBlockExUnits": { + "exUnitsMem": 62000000, + "exUnitsSteps": 40000000000 + }, + "maxCollateralInputs": 3, + "maxTxExUnits": { + "exUnitsMem": 14000000, + "exUnitsSteps": 10000000000 + }, + "maxValueSize": 5000 +} diff --git a/cardano-api/test/cardano-api-test/files/input/genesis/spec.alonzo-v2-cost-model-map-175.json b/cardano-api/test/cardano-api-test/files/input/genesis/spec.alonzo-v2-cost-model-map-175.json new file mode 100644 index 0000000000..92b58b19d0 --- /dev/null +++ b/cardano-api/test/cardano-api-test/files/input/genesis/spec.alonzo-v2-cost-model-map-175.json @@ -0,0 +1,375 @@ +{ + "coinsPerUTxOByte": 4310, + "collateralPercentage": 150, + "costModels": { + "PlutusV1": { + "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-cpu-arguments-intercept": 117366, + "blake2b-cpu-arguments-slope": 10475, + "blake2b-memory-arguments": 4, + "cekApplyCost-exBudgetCPU": 23000, + "cekApplyCost-exBudgetMemory": 100, + "cekBuiltinCost-exBudgetCPU": 23000, + "cekBuiltinCost-exBudgetMemory": 100, + "cekConstCost-exBudgetCPU": 23000, + "cekConstCost-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, + "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, + "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, + "verifyEd25519Signature-cpu-arguments-intercept": 9462713, + "verifyEd25519Signature-cpu-arguments-slope": 1021, + "verifyEd25519Signature-memory-arguments": 10, + "verifySignature-cpu-arguments-intercept": 3345831, + "verifySignature-cpu-arguments-slope": 1, + "verifySignature-memory-arguments": 1 + }, + "PlutusV2": { + "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_256-cpu-arguments-intercept": 117366, + "blake2b_256-cpu-arguments-slope": 10475, + "blake2b_256-memory-arguments": 4, + "cekApplyCost-exBudgetCPU": 23000, + "cekApplyCost-exBudgetMemory": 100, + "cekBuiltinCost-exBudgetCPU": 23000, + "cekBuiltinCost-exBudgetMemory": 100, + "cekConstCost-exBudgetCPU": 23000, + "cekConstCost-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, + "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": 35892428, + "verifyEcdsaSecp256k1Signature-memory-arguments": 10, + "verifyEd25519Signature-cpu-arguments-intercept": 57996947, + "verifyEd25519Signature-cpu-arguments-slope": 18975, + "verifyEd25519Signature-memory-arguments": 10, + "verifySchnorrSecp256k1Signature-cpu-arguments-intercept": 38887044, + "verifySchnorrSecp256k1Signature-cpu-arguments-slope": 32947, + "verifySchnorrSecp256k1Signature-memory-arguments": 10 + } + }, + "executionPrices": { + "prMem": { + "denominator": 10000, + "numerator": 577 + }, + "prSteps": { + "denominator": 10000000, + "numerator": 721 + } + }, + "lovelacePerUTxOWord": 4310, + "maxBlockExUnits": { + "exUnitsMem": 62000000, + "exUnitsSteps": 40000000000 + }, + "maxCollateralInputs": 3, + "maxTxExUnits": { + "exUnitsMem": 14000000, + "exUnitsSteps": 10000000000 + }, + "maxValueSize": 5000 +} diff --git a/cardano-api/test/cardano-api-test/files/input/genesis/spec.alonzo-v2-cost-model-map-185.json b/cardano-api/test/cardano-api-test/files/input/genesis/spec.alonzo-v2-cost-model-map-185.json new file mode 100644 index 0000000000..201172e460 --- /dev/null +++ b/cardano-api/test/cardano-api-test/files/input/genesis/spec.alonzo-v2-cost-model-map-185.json @@ -0,0 +1,385 @@ +{ + "coinsPerUTxOByte": 4310, + "collateralPercentage": 150, + "costModels": { + "PlutusV1": { + "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-cpu-arguments-intercept": 117366, + "blake2b-cpu-arguments-slope": 10475, + "blake2b-memory-arguments": 4, + "cekApplyCost-exBudgetCPU": 23000, + "cekApplyCost-exBudgetMemory": 100, + "cekBuiltinCost-exBudgetCPU": 23000, + "cekBuiltinCost-exBudgetMemory": 100, + "cekConstCost-exBudgetCPU": 23000, + "cekConstCost-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, + "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, + "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, + "verifyEd25519Signature-cpu-arguments-intercept": 9462713, + "verifyEd25519Signature-cpu-arguments-slope": 1021, + "verifyEd25519Signature-memory-arguments": 10, + "verifySignature-cpu-arguments-intercept": 3345831, + "verifySignature-cpu-arguments-slope": 1, + "verifySignature-memory-arguments": 1 + }, + "PlutusV2": { + "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_256-cpu-arguments-intercept": 117366, + "blake2b_256-cpu-arguments-slope": 10475, + "blake2b_256-memory-arguments": 4, + "cekApplyCost-exBudgetCPU": 23000, + "cekApplyCost-exBudgetMemory": 100, + "cekBuiltinCost-exBudgetCPU": 23000, + "cekBuiltinCost-exBudgetMemory": 100, + "cekConstCost-exBudgetCPU": 23000, + "cekConstCost-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, + "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": 35892428, + "verifyEcdsaSecp256k1Signature-memory-arguments": 10, + "verifyEd25519Signature-cpu-arguments-intercept": 57996947, + "verifyEd25519Signature-cpu-arguments-slope": 18975, + "verifyEd25519Signature-memory-arguments": 10, + "verifySchnorrSecp256k1Signature-cpu-arguments-intercept": 38887044, + "verifySchnorrSecp256k1Signature-cpu-arguments-slope": 32947, + "verifySchnorrSecp256k1Signature-memory-arguments": 10, + "integerToByteString-cpu-arguments-c0": 1292075, + "integerToByteString-cpu-arguments-c1": 24469, + "integerToByteString-cpu-arguments-c2": 74, + "integerToByteString-memory-arguments-intercept": 0, + "integerToByteString-memory-arguments-slope": 1, + "byteStringToInteger-cpu-arguments-c0": 936157, + "byteStringToInteger-cpu-arguments-c1": 49601, + "byteStringToInteger-cpu-arguments-c2": 237, + "byteStringToInteger-memory-arguments-intercept": 0, + "byteStringToInteger-memory-arguments-slope": 1 + } + }, + "executionPrices": { + "prMem": { + "denominator": 10000, + "numerator": 577 + }, + "prSteps": { + "denominator": 10000000, + "numerator": 721 + } + }, + "lovelacePerUTxOWord": 4310, + "maxBlockExUnits": { + "exUnitsMem": 62000000, + "exUnitsSteps": 40000000000 + }, + "maxCollateralInputs": 3, + "maxTxExUnits": { + "exUnitsMem": 14000000, + "exUnitsSteps": 10000000000 + }, + "maxValueSize": 5000 +}