From 385c571740de7493356582817f15a0c51aa37c19 Mon Sep 17 00:00:00 2001 From: Federico Mastellone Date: Tue, 25 Feb 2025 13:34:46 +0000 Subject: [PATCH] WIP: dummy ProtocolParameters --- .../Api/Internal/ProtocolParameters.hs | 25 +++++++++++++++++++ .../src/Cardano/Benchmarking/Script/Aeson.hs | 2 +- .../src/Cardano/Benchmarking/Script/Core.hs | 8 +++--- .../src/Cardano/Benchmarking/Script/Types.hs | 2 +- .../src/Cardano/TxGenerator/PlutusContext.hs | 2 +- .../src/Cardano/TxGenerator/PureExample.hs | 2 +- .../src/Cardano/TxGenerator/Setup/Plutus.hs | 4 +-- .../src/Cardano/TxGenerator/Types.hs | 3 +-- bench/tx-generator/test/ApiTest.hs | 3 ++- bench/tx-generator/tx-generator.cabal | 6 +++-- 10 files changed, 42 insertions(+), 15 deletions(-) create mode 100644 bench/tx-generator/src/Cardano/Api/Internal/ProtocolParameters.hs diff --git a/bench/tx-generator/src/Cardano/Api/Internal/ProtocolParameters.hs b/bench/tx-generator/src/Cardano/Api/Internal/ProtocolParameters.hs new file mode 100644 index 00000000000..314e35f5c38 --- /dev/null +++ b/bench/tx-generator/src/Cardano/Api/Internal/ProtocolParameters.hs @@ -0,0 +1,25 @@ +-- | The various Cardano protocol parameters, including: +-- +-- * the current values of updatable protocol parameters: 'ProtocolParameters' +module Cardano.Api.Internal.ProtocolParameters + ( -- * The updatable protocol parameters + ProtocolParameters (..) + , convertToLedgerProtocolParameters + , toLedgerPParams + , fromLedgerPParams + ) +where + +-------------------------------------------------------------------------------- + +data ProtocolParameters = ProtocolParameters + { protocolParamPrices :: Int + , protocolParamMaxTxExUnits :: Int + , protocolParamCostModels :: Int + } +convertToLedgerProtocolParameters :: () +convertToLedgerProtocolParameters = error "" +toLedgerPParams :: () +toLedgerPParams = error "" +fromLedgerPParams :: () +fromLedgerPParams = error "" diff --git a/bench/tx-generator/src/Cardano/Benchmarking/Script/Aeson.hs b/bench/tx-generator/src/Cardano/Benchmarking/Script/Aeson.hs index 353c2f5c2c1..ffefc825d23 100644 --- a/bench/tx-generator/src/Cardano/Benchmarking/Script/Aeson.hs +++ b/bench/tx-generator/src/Cardano/Benchmarking/Script/Aeson.hs @@ -22,7 +22,7 @@ import qualified Data.Attoparsec.ByteString as Atto import qualified Data.Yaml as Yaml (encode) import Cardano.Api -import Cardano.Api.Shelley (ProtocolParameters) +import Cardano.Api.Internal.ProtocolParameters (ProtocolParameters) import Cardano.Benchmarking.Script.Types import Cardano.TxGenerator.Internal.Orphans () diff --git a/bench/tx-generator/src/Cardano/Benchmarking/Script/Core.hs b/bench/tx-generator/src/Cardano/Benchmarking/Script/Core.hs index 90d0898cf22..acd7ac8a5fc 100644 --- a/bench/tx-generator/src/Cardano/Benchmarking/Script/Core.hs +++ b/bench/tx-generator/src/Cardano/Benchmarking/Script/Core.hs @@ -18,10 +18,10 @@ module Cardano.Benchmarking.Script.Core where -import Cardano.Api -import Cardano.Api.Shelley (PlutusScriptOrReferenceInput (..), ProtocolParameters, - ShelleyLedgerEra, convertToLedgerProtocolParameters, protocolParamMaxTxExUnits, - protocolParamPrices) +import Cardano.Api hiding (toLedgerPParams, fromLedgerPParams) +import Cardano.Api.Shelley (PlutusScriptOrReferenceInput (..), + ShelleyLedgerEra) +import Cardano.Api.Internal.ProtocolParameters (toLedgerPParams, fromLedgerPParams, ProtocolParameters, convertToLedgerProtocolParameters, protocolParamPrices, protocolParamMaxTxExUnits) import Cardano.Benchmarking.GeneratorTx as GeneratorTx (AsyncBenchmarkControl) import qualified Cardano.Benchmarking.GeneratorTx as GeneratorTx (waitBenchmark, walletBenchmark) diff --git a/bench/tx-generator/src/Cardano/Benchmarking/Script/Types.hs b/bench/tx-generator/src/Cardano/Benchmarking/Script/Types.hs index 7d1a68583cf..55d547a0980 100644 --- a/bench/tx-generator/src/Cardano/Benchmarking/Script/Types.hs +++ b/bench/tx-generator/src/Cardano/Benchmarking/Script/Types.hs @@ -40,7 +40,7 @@ module Cardano.Benchmarking.Script.Types ( import Cardano.Api import qualified Cardano.Api.Ledger as L -import Cardano.Api.Shelley +import Cardano.Api.Internal.ProtocolParameters (ProtocolParameters) import Cardano.Benchmarking.OuroborosImports (SigningKeyFile) import Cardano.Node.Configuration.NodeAddress (NodeIPv4Address) diff --git a/bench/tx-generator/src/Cardano/TxGenerator/PlutusContext.hs b/bench/tx-generator/src/Cardano/TxGenerator/PlutusContext.hs index f748286a96c..21d6ddefb22 100644 --- a/bench/tx-generator/src/Cardano/TxGenerator/PlutusContext.hs +++ b/bench/tx-generator/src/Cardano/TxGenerator/PlutusContext.hs @@ -26,7 +26,7 @@ module Cardano.TxGenerator.PlutusContext where import Cardano.Api -import Cardano.Api.Shelley (ProtocolParameters (..)) +import Cardano.Api.Internal.ProtocolParameters (ProtocolParameters (..)) import Cardano.Ledger.Coin (Coin) import Cardano.TxGenerator.Setup.Plutus (preExecutePlutusScript) diff --git a/bench/tx-generator/src/Cardano/TxGenerator/PureExample.hs b/bench/tx-generator/src/Cardano/TxGenerator/PureExample.hs index ed4f27d63d9..b18510bbfbc 100644 --- a/bench/tx-generator/src/Cardano/TxGenerator/PureExample.hs +++ b/bench/tx-generator/src/Cardano/TxGenerator/PureExample.hs @@ -7,7 +7,7 @@ module Cardano.TxGenerator.PureExample where import Cardano.Api -import Cardano.Api.Shelley (convertToLedgerProtocolParameters) +import Cardano.Api.Internal.ProtocolParameters (convertToLedgerProtocolParameters) import qualified Cardano.Ledger.Coin as L import Cardano.TxGenerator.FundQueue diff --git a/bench/tx-generator/src/Cardano/TxGenerator/Setup/Plutus.hs b/bench/tx-generator/src/Cardano/TxGenerator/Setup/Plutus.hs index 9a2d1bad7c2..aa6d7a00e92 100644 --- a/bench/tx-generator/src/Cardano/TxGenerator/Setup/Plutus.hs +++ b/bench/tx-generator/src/Cardano/TxGenerator/Setup/Plutus.hs @@ -26,8 +26,8 @@ import Control.Monad.Writer (runWriter) import Cardano.CLI.Read (readFileScriptInAnyLang) import Cardano.Api -import Cardano.Api.Shelley (PlutusScript (..), ProtocolParameters (..), fromAlonzoExUnits, - protocolParamCostModels, toPlutusData) +import Cardano.Api.Shelley (PlutusScript (..), fromAlonzoExUnits, toPlutusData) +import Cardano.Api.Internal.ProtocolParameters (ProtocolParameters (..)) import Cardano.Ledger.Plutus.TxInfo (exBudgetToExUnits) import qualified PlutusLedgerApi.V1 as PlutusV1 diff --git a/bench/tx-generator/src/Cardano/TxGenerator/Types.hs b/bench/tx-generator/src/Cardano/TxGenerator/Types.hs index 741fbe2794d..b39618e8576 100644 --- a/bench/tx-generator/src/Cardano/TxGenerator/Types.hs +++ b/bench/tx-generator/src/Cardano/TxGenerator/Types.hs @@ -14,8 +14,7 @@ module Cardano.TxGenerator.Types where import Cardano.Api -import Cardano.Api.Shelley (ProtocolParameters) - +import Cardano.Api.Internal.ProtocolParameters (ProtocolParameters) import qualified Cardano.Ledger.Coin as L import Cardano.Ledger.Crypto (StandardCrypto) import qualified Cardano.Ledger.Shelley.API as Ledger (ShelleyGenesis) diff --git a/bench/tx-generator/test/ApiTest.hs b/bench/tx-generator/test/ApiTest.hs index deb14b767b4..102a0931ecf 100644 --- a/bench/tx-generator/test/ApiTest.hs +++ b/bench/tx-generator/test/ApiTest.hs @@ -14,7 +14,8 @@ module Main (module Main) where import Cardano.Api import qualified Cardano.Api.Ledger as Api -import Cardano.Api.Shelley (ProtocolParameters (..), fromPlutusData) +import Cardano.Api.Shelley (fromPlutusData) +import Cardano.Api.Internal.ProtocolParameters (ProtocolParameters (..)) #ifdef WITH_LIBRARY import Cardano.Benchmarking.PlutusScripts diff --git a/bench/tx-generator/tx-generator.cabal b/bench/tx-generator/tx-generator.cabal index 65c6da53051..61700f4cb20 100644 --- a/bench/tx-generator/tx-generator.cabal +++ b/bench/tx-generator/tx-generator.cabal @@ -92,7 +92,8 @@ library Cardano.TxGenerator.Internal.Orphans - other-modules: Cardano.TxGenerator.Internal.Fifo + other-modules: Cardano.Api.Internal.ProtocolParameters + Cardano.TxGenerator.Internal.Fifo -- Cardano.TxGenerator.Internal.Orphans Paths_tx_generator @@ -203,7 +204,8 @@ test-suite tx-generator-apitest , transformers-except , tx-generator - other-modules: Paths_tx_generator + other-modules: Cardano.Api.Internal.ProtocolParameters + , Paths_tx_generator autogen-modules: Paths_tx_generator test-suite tx-generator-test