From cccc4c43c30a59d89a7f6746b871336fea8cea9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Hurlin?= Date: Thu, 9 Jan 2025 15:30:40 +0100 Subject: [PATCH 1/4] create-protocol-parameters-update: validate cost models' size --- cardano-cli/cardano-cli.cabal | 1 + .../CLI/EraBased/Run/Governance/Actions.hs | 4 +- cardano-cli/src/Cardano/CLI/Read.hs | 44 +++++++++++++++++-- 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/cardano-cli/cardano-cli.cabal b/cardano-cli/cardano-cli.cabal index d70597a13b..3b83440400 100644 --- a/cardano-cli/cardano-cli.cabal +++ b/cardano-cli/cardano-cli.cabal @@ -238,6 +238,7 @@ library network-uri, optparse-applicative-fork, parsec, + plutus-ledger-api, prettyprinter, prettyprinter-ansi-terminal, random, diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs index f414df01ed..ba51a1d76e 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs @@ -311,7 +311,6 @@ runGovernanceActionCreateProtocolParametersUpdateCmd => Cmd.GovernanceActionProtocolParametersUpdateCmdArgs era -> ExceptT GovernanceActionsError IO () runGovernanceActionCreateProtocolParametersUpdateCmd eraBasedPParams' = do - let sbe = uppShelleyBasedEra eraBasedPParams' caseShelleyToBabbageOrConwayEraOnwards ( \sToB -> do let oFp = uppFilePath eraBasedPParams' @@ -387,13 +386,14 @@ runGovernanceActionCreateProtocolParametersUpdateCmd eraBasedPParams' = do ) sbe where + sbe = uppShelleyBasedEra eraBasedPParams' theUpdate = case uppCostModelsFile eraBasedPParams' of Nothing -> pure $ uppNewPParams eraBasedPParams' Just (Cmd.CostModelsFile alonzoOnwards costModelsFile) -> do costModels <- firstExceptT GovernanceActionsCmdCostModelsError $ - readCostModels costModelsFile + readCostModels sbe costModelsFile pure . addCostModelsToEraBasedProtocolParametersUpdate alonzoOnwards costModels $ uppNewPParams eraBasedPParams' diff --git a/cardano-cli/src/Cardano/CLI/Read.hs b/cardano-cli/src/Cardano/CLI/Read.hs index a31096f5ba..03ce859212 100644 --- a/cardano-cli/src/Cardano/CLI/Read.hs +++ b/cardano-cli/src/Cardano/CLI/Read.hs @@ -6,6 +6,7 @@ {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TupleSections #-} +{-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeFamilies #-} module Cardano.CLI.Read @@ -119,11 +120,14 @@ import Cardano.CLI.Types.Errors.StakeCredentialError import Cardano.CLI.Types.Governance import Cardano.CLI.Types.Key import qualified Cardano.Crypto.Hash as Crypto +import qualified PlutusLedgerApi.V1.ParamName as PlutusV1 +import qualified PlutusLedgerApi.V2.ParamName as PlutusV2 +import qualified PlutusLedgerApi.V3.ParamName as PlutusV3 import Prelude import Control.Exception (bracket, displayException) -import Control.Monad (forM, unless, when) +import Control.Monad (forM, forM_, unless, when) import qualified Data.Aeson as Aeson import Data.Bifunctor import Data.ByteString (ByteString) @@ -134,6 +138,7 @@ import qualified Data.ByteString.Lazy.Char8 as LBS import Data.Function ((&)) import Data.IORef (IORef, newIORef, readIORef, writeIORef) import qualified Data.List as List +import qualified Data.Map as Map import Data.Proxy (Proxy (..)) import Data.String import Data.Text (Text) @@ -1057,6 +1062,9 @@ data CostModelsError = CostModelsErrorReadFile (FileError ()) | CostModelsErrorJSONDecode FilePath String | CostModelsErrorEmpty FilePath + | -- | @CostModelsErrorWrongSize expected actual@ indicates that the cost model + -- has @actual@ entries, but @expected@ entries were expected. + CostModelsErrorWrongSize Int Int deriving Show instance Error CostModelsError where @@ -1067,6 +1075,11 @@ instance Error CostModelsError where "Error decoding JSON cost model at " <> pshow fp <> ": " <> pretty err <> formatExplanation CostModelsErrorEmpty fp -> "The decoded cost model was empty at: " <> pshow fp <> formatExplanation + CostModelsErrorWrongSize expected actual -> + "The decoded cost model has the wrong size: expected " + <> pretty expected + <> ", but got " + <> pretty actual where formatExplanation = vsep @@ -1086,13 +1099,38 @@ instance Error CostModelsError where ] readCostModels - :: File L.CostModels In + :: () + => ShelleyBasedEra era + -> File L.CostModels In -> ExceptT CostModelsError IO L.CostModels -readCostModels (File fp) = do +readCostModels sbe (File fp) = do bytes <- handleIOExceptT (CostModelsErrorReadFile . FileIOError fp) $ LBS.readFile fp costModels <- firstExceptT (CostModelsErrorJSONDecode fp) . except $ Aeson.eitherDecode bytes when (null $ fromAlonzoCostModels costModels) $ throwE $ CostModelsErrorEmpty fp + forM_ (allValues @L.Language) $ checkCostModelSize costModels return costModels + where + checkCostModelSize :: L.CostModels -> L.Language -> ExceptT CostModelsError IO () + checkCostModelSize models lang = + case Map.lookup lang (L.costModelsValid models) of + Nothing -> pure () + Just (model :: L.CostModel) -> do + let actual = Map.size (L.costModelToMap model) + expected = languageToParameterCount lang + unless (expected == actual) $ throwE $ CostModelsErrorWrongSize expected actual + return () + allValues :: forall a. (Bounded a, Enum a) => [a] + allValues = [minBound :: a .. maxBound] + languageToParameterCount :: L.Language -> Int + languageToParameterCount = \case + L.PlutusV1 -> length $ allValues @PlutusV1.ParamName -- 166 + L.PlutusV2 -> + let nbParamNames = length $ allValues @PlutusV2.ParamName in -- 185 + caseShelleyToBabbageOrConwayEraOnwards + (const $ nbParamNames - 10) -- Ten parameters were added to V2 in Conway, need to remove them here + (const nbParamNames) + sbe + L.PlutusV3 -> length $ allValues @PlutusV3.ParamName -- 297 -- Misc From 0137ef1855b5e902067ce6c4c27fcb33ea387f60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Hurlin?= Date: Thu, 9 Jan 2025 16:06:21 +0100 Subject: [PATCH 2/4] Adapt existing test --- .../Test/Golden/Governance/Action.hs | 2 ++ ...tocol-parameters-update-partial-costmodels.action | 2 +- .../files/input/governance/costmodels-partial.json | 12 +++++++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Action.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Action.hs index 5a80d97aa8..5297b3e1ba 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Action.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Action.hs @@ -460,6 +460,8 @@ base_golden_conway_governance_action_create_protocol_parameters_update hash temp "test/cardano-cli-golden/files/golden/governance/action/conway-create-protocol-parameters-update.action" H.diffFileVsGoldenFile actionFile goldenActionFile +-- | Execute me with: +-- @cabal test cardano-cli-golden --test-options '-p "/golden conway governance action create protocol parameters update partial costmodel/"'@ hprop_golden_conway_governance_action_create_protocol_parameters_update_partial_costmodel :: Property hprop_golden_conway_governance_action_create_protocol_parameters_update_partial_costmodel = diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/action/conway-create-protocol-parameters-update-partial-costmodels.action b/cardano-cli/test/cardano-cli-golden/files/golden/governance/action/conway-create-protocol-parameters-update-partial-costmodels.action index 82228194a6..ce204d8d70 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/governance/action/conway-create-protocol-parameters-update-partial-costmodels.action +++ b/cardano-cli/test/cardano-cli-golden/files/golden/governance/action/conway-create-protocol-parameters-update-partial-costmodels.action @@ -1,5 +1,5 @@ { "type": "Governance proposal", "description": "Update protocol parameters proposal", - "cborHex": "84193039581de18f4a3466a404c11eb410313015b88e447d81b60089e25f611600e6058400f6a112a1019f1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a0011b22c1a0005fdde00021a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a0223accc0a1a009063b91903fd0a1a02515e841980b30afff6826b6578616d706c652e636f6d5820c7ddb5b493faa4d3d2d679847740bdce0c5d358d56f9b1470ca67f5652a02745" + "cborHex": "84193039581de18f4a3466a404c11eb410313015b88e447d81b60089e25f611600e6058400f6a112a1019f1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a0011b22c1a0005fdde00021a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a0223accc0a1a009063b91903fd0a1a02515e841980b30a00000000000000000000fff6826b6578616d706c652e636f6d5820c7ddb5b493faa4d3d2d679847740bdce0c5d358d56f9b1470ca67f5652a02745" } diff --git a/cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels-partial.json b/cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels-partial.json index eb44f4cb36..58f15b0d60 100644 --- a/cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels-partial.json +++ b/cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels-partial.json @@ -173,6 +173,16 @@ 10, 38887044, 32947, - 10 + 10, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 ] } From 942cf60901082aaa661880ec50485ebf34502e77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Hurlin?= Date: Thu, 9 Jan 2025 15:03:42 +0100 Subject: [PATCH 3/4] Add SRP to API !!DO NOT MERGE!! --- cabal.project | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cabal.project b/cabal.project index 78564acb13..12ca5b8e86 100644 --- a/cabal.project +++ b/cabal.project @@ -60,3 +60,9 @@ write-ghc-environment-files: always -- IMPORTANT -- Do NOT add more source-repository-package stanzas here unless they are strictly -- temporary! Please read the section in CONTRIBUTING about updating dependencies. + +source-repository-package + type: git + location: https://github.com/IntersectMBO/cardano-api + subdir: cardano-api + tag: 4ab850fcdefe8536fb98274ba5eaf54030a852e8 From a2ce41cb05df4ede8f5ab537cd5f8f8356eaac90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Hurlin?= Date: Thu, 9 Jan 2025 16:44:58 +0100 Subject: [PATCH 4/4] Add tests for wrong cost models sizes --- .../Test/Golden/Governance/Action.hs | 104 ++++++ .../governance/costmodels-v1-too-large.json | 170 ++++++++++ .../governance/costmodels-v1-too-small.json | 168 ++++++++++ .../governance/costmodels-v2-too-large.json | 189 +++++++++++ .../governance/costmodels-v2-too-small.json | 187 +++++++++++ .../governance/costmodels-v3-too-large.json | 301 ++++++++++++++++++ .../governance/costmodels-v3-too-small.json | 187 +++++++++++ 7 files changed, 1306 insertions(+) create mode 100644 cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels-v1-too-large.json create mode 100644 cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels-v1-too-small.json create mode 100644 cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels-v2-too-large.json create mode 100644 cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels-v2-too-small.json create mode 100644 cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels-v3-too-large.json create mode 100644 cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels-v3-too-small.json diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Action.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Action.hs index 5297b3e1ba..a8910cd737 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Action.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Action.hs @@ -9,6 +9,8 @@ import Cardano.Api (MonadIO) import Control.Monad (void) import Control.Monad.Catch (MonadCatch) import Control.Monad.Trans.Control (MonadBaseControl) +import Data.List (isInfixOf) +import System.Exit (ExitCode (ExitSuccess)) import Test.Cardano.CLI.Hash (exampleAnchorDataHash, exampleAnchorDataHash2, exampleAnchorDataIpfsHash, exampleAnchorDataIpfsHash2, @@ -497,6 +499,108 @@ hprop_golden_conway_governance_action_create_protocol_parameters_update_partial_ "test/cardano-cli-golden/files/golden/governance/action/conway-create-protocol-parameters-update-partial-costmodels.action" H.diffFileVsGoldenFile actionFile goldenActionFile +-- | Execute me with: +-- @cabal test cardano-cli-golden --test-options '-p "/golden conway governance action create protocol parameters too small costmodel size/"'@ +hprop_golden_conway_governance_action_create_protocol_parameters_too_small_costmodel_size + :: Property +hprop_golden_conway_governance_action_create_protocol_parameters_too_small_costmodel_size = + propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do + -- This file has 165 entries, whereas PV1 requires 166 + runOnCostModelFile + tempDir + "test/cardano-cli-golden/files/input/governance/costmodels-v1-too-small.json" + -- This file has 184 entries, whereas PV2 requires 185 + runOnCostModelFile + tempDir + "test/cardano-cli-golden/files/input/governance/costmodels-v2-too-small.json" + -- This file has 184 entries, whereas PV3 requires 297 + runOnCostModelFile + tempDir + "test/cardano-cli-golden/files/input/governance/costmodels-v3-too-small.json" + where + runOnCostModelFile tempDir costModelsFile = do + stakeAddressVKeyFile <- H.note "test/cardano-cli-golden/files/input/governance/stake-address.vkey" + + actionFile <- noteTempFile tempDir "action" + + (exitCode, _stdout, stderr) <- + H.noteShowM $ + H.execDetailCardanoCLI + [ "conway" + , "governance" + , "action" + , "create-protocol-parameters-update" + , "--anchor-url" + , "example.com" + , "--anchor-data-hash" + , "c7ddb5b493faa4d3d2d679847740bdce0c5d358d56f9b1470ca67f5652a02745" + , "--mainnet" + , "--deposit-return-stake-verification-key-file" + , stakeAddressVKeyFile + , "--governance-action-deposit" + , "12345" + , "--cost-model-file" + , costModelsFile + , "--out-file" + , actionFile + ] + + H.assert (exitCode /= ExitSuccess) + H.assertWith stderr $ \msg -> "The decoded cost model has the wrong size" `isInfixOf` msg + +-- | Execute me with: +-- @cabal test cardano-cli-golden --test-options '-p "/golden conway governance action create protocol parameters too large costmodel size/"'@ +hprop_golden_conway_governance_action_create_protocol_parameters_too_large_costmodel_size + :: Property +hprop_golden_conway_governance_action_create_protocol_parameters_too_large_costmodel_size = + propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do + -- From https://input-output-rnd.slack.com/archives/CCRB7BU8Y/p1727096158830419?thread_ts=1727089226.813099&cid=CCRB7BU8Y + -- + -- Having too large models is fine: + -- + -- Ziyang Liu + -- There should not be any check on the upper bound. The number of parameters for V1, V2 and V3 can increase at any time as we add new builtins or other features to the languages. + -- Theoretically they can also possibly decrease but that's very unlikely, certainly not below the current numbers. + + -- This file has 167 entries, whereas PV1 requires 166 + runOnCostModelFile + tempDir + "test/cardano-cli-golden/files/input/governance/costmodels-v1-too-large.json" + -- This file has 186 entries, whereas PV2 requires 185 + runOnCostModelFile + tempDir + "test/cardano-cli-golden/files/input/governance/costmodels-v2-too-large.json" + -- This file has 298 entries, whereas PV3 requires 297 + runOnCostModelFile + tempDir + "test/cardano-cli-golden/files/input/governance/costmodels-v3-too-large.json" + where + runOnCostModelFile tempDir costModelsFile = do + stakeAddressVKeyFile <- H.note "test/cardano-cli-golden/files/input/governance/stake-address.vkey" + + actionFile <- noteTempFile tempDir "action" + + H.noteShowM_ $ + H.execCardanoCLI + [ "conway" + , "governance" + , "action" + , "create-protocol-parameters-update" + , "--anchor-url" + , "example.com" + , "--anchor-data-hash" + , "c7ddb5b493faa4d3d2d679847740bdce0c5d358d56f9b1470ca67f5652a02745" + , "--mainnet" + , "--deposit-return-stake-verification-key-file" + , stakeAddressVKeyFile + , "--governance-action-deposit" + , "12345" + , "--cost-model-file" + , costModelsFile + , "--out-file" + , actionFile + ] + hprop_golden_conway_governance_action_create_hardfork_wrong_hash_fails :: Property hprop_golden_conway_governance_action_create_hardfork_wrong_hash_fails = propertyOnce . expectFailure . H.moduleWorkspace "tmp" $ \tempDir -> do diff --git a/cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels-v1-too-large.json b/cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels-v1-too-large.json new file mode 100644 index 0000000000..2a02176827 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels-v1-too-large.json @@ -0,0 +1,170 @@ +{ "PlutusV1": [ + 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, + 0, + 0, + 0, + 0, + 0, + 1, + 1 + ] +} diff --git a/cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels-v1-too-small.json b/cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels-v1-too-small.json new file mode 100644 index 0000000000..f1be7f016a --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels-v1-too-small.json @@ -0,0 +1,168 @@ +{ "PlutusV1": [ + 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, + 0, + 0, + 0, + 0, + 0 + ] +} diff --git a/cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels-v2-too-large.json b/cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels-v2-too-large.json new file mode 100644 index 0000000000..0419532fd4 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels-v2-too-large.json @@ -0,0 +1,189 @@ +{ "PlutusV2": [ + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1 + ] +} diff --git a/cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels-v2-too-small.json b/cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels-v2-too-small.json new file mode 100644 index 0000000000..a953433332 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels-v2-too-small.json @@ -0,0 +1,187 @@ +{ "PlutusV2": [ + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] +} diff --git a/cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels-v3-too-large.json b/cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels-v3-too-large.json new file mode 100644 index 0000000000..fa4b65b0aa --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels-v3-too-large.json @@ -0,0 +1,301 @@ +{ "PlutusV3": [ + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ] +} diff --git a/cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels-v3-too-small.json b/cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels-v3-too-small.json new file mode 100644 index 0000000000..fc000abaac --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/input/governance/costmodels-v3-too-small.json @@ -0,0 +1,187 @@ +{ "PlutusV3": [ + 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, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] +}