From ac73f6bbaf0d179f93e7047f2e322ef0283c8f84 Mon Sep 17 00:00:00 2001 From: Sasha Bogicevic Date: Sun, 24 Dec 2023 20:09:31 +0100 Subject: [PATCH] Remove pparams file and use default ones when needed --- hydra-cluster/config/pparams.json | 1 - hydra-cluster/hydra-cluster.cabal | 1 - hydra-cluster/src/Hydra/Cluster/Fixture.hs | 5 ----- hydra-cluster/test/Test/EndToEndSpec.hs | 13 +++++-------- 4 files changed, 5 insertions(+), 15 deletions(-) delete mode 100644 hydra-cluster/config/pparams.json diff --git a/hydra-cluster/config/pparams.json b/hydra-cluster/config/pparams.json deleted file mode 100644 index 1070ea2ecf9..00000000000 --- a/hydra-cluster/config/pparams.json +++ /dev/null @@ -1 +0,0 @@ -{"a0":0.0,"coinsPerUTxOByte":4310,"collateralPercentage":150,"costmdls":{"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,57996947,18975,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,57996947,18975,10,38887044,32947,10]},"eMax":18,"keyDeposit":0,"maxBlockBodySize":65536,"maxBlockExUnits":{"exUnitsMem":62000000,"exUnitsSteps":40000000000},"maxBlockHeaderSize":1100,"maxCollateralInputs":3,"maxTxExUnits":{"exUnitsMem":14000000,"exUnitsSteps":10000000000},"maxTxSize":16384,"maxValSize":5000,"minFeeA":0,"minFeeB":0,"minPoolCost":0,"nOpt":100,"poolDeposit":0,"prices":{"prMem":5.77e-2,"prSteps":7.21e-5},"protocolVersion":{"major":7,"minor":0},"rho":0.1,"tau":0.1,"txFeeFixed":0,"txFeePerByte":0} diff --git a/hydra-cluster/hydra-cluster.cabal b/hydra-cluster/hydra-cluster.cabal index 02b3cd7d931..4ee6f6b0f84 100644 --- a/hydra-cluster/hydra-cluster.cabal +++ b/hydra-cluster/hydra-cluster.cabal @@ -31,7 +31,6 @@ data-files: config/devnet/kes.skey config/devnet/opcert.cert config/devnet/vrf.skey - config/pparams.json source-repository head type: git diff --git a/hydra-cluster/src/Hydra/Cluster/Fixture.hs b/hydra-cluster/src/Hydra/Cluster/Fixture.hs index 080b08566db..2a79e6da2aa 100644 --- a/hydra-cluster/src/Hydra/Cluster/Fixture.hs +++ b/hydra-cluster/src/Hydra/Cluster/Fixture.hs @@ -5,12 +5,10 @@ module Hydra.Cluster.Fixture where import Hydra.Prelude -import Cardano.Ledger.Core (PParams) import Hydra.Cardano.Api (NetworkId) import Hydra.Cardano.Api qualified as Api import Hydra.ContestationPeriod (ContestationPeriod (..)) import Hydra.Crypto (HydraKey, SigningKey, VerificationKey, generateSigningKey, getVerificationKey) -import Hydra.Ledger.Cardano.Configuration (pparamsFromJson, readJsonFileThrow) import Hydra.Party (Party, deriveParty) alice, bob, carol :: Party @@ -39,9 +37,6 @@ cperiod = UnsafeContestationPeriod 10 defaultNetworkId :: NetworkId defaultNetworkId = Api.Testnet (Api.NetworkMagic 42) -loadDefaultPParams :: IO (PParams Api.LedgerEra) -loadDefaultPParams = readJsonFileThrow pparamsFromJson "./config/pparams.json" - -- NOTE: This is hard-coded and needs to correspond to the initial funds set in -- the genesis-shelley.json file. availableInitialFunds :: Num a => a diff --git a/hydra-cluster/test/Test/EndToEndSpec.hs b/hydra-cluster/test/Test/EndToEndSpec.hs index da925684695..15aaf949e5d 100644 --- a/hydra-cluster/test/Test/EndToEndSpec.hs +++ b/hydra-cluster/test/Test/EndToEndSpec.hs @@ -51,7 +51,7 @@ import Hydra.Cardano.Api ( unEpochNo, pattern TxValidityLowerBound, ) -import Hydra.Chain.Direct.Fixture (testNetworkId) +import Hydra.Chain.Direct.Fixture (defaultPParams, testNetworkId) import Hydra.Chain.Direct.State () import Hydra.Cluster.Faucet ( publishHydraScriptsAs, @@ -71,7 +71,6 @@ import Hydra.Cluster.Fixture ( carolVk, cperiod, defaultNetworkId, - loadDefaultPParams, ) import Hydra.Cluster.Scenarios ( EndToEndLog (..), @@ -93,7 +92,6 @@ import Hydra.Cluster.Util (chainConfigFor, keysFor, modifyConfig) import Hydra.ContestationPeriod (ContestationPeriod (UnsafeContestationPeriod)) import Hydra.Ledger (txId) import Hydra.Ledger.Cardano (genKeyPair, genUTxOFor, mkRangedTx, mkSimpleTx) -import Hydra.Ledger.Cardano.Configuration (pparamsFromJson, readJsonFileThrow) import Hydra.Logging (Tracer, showLogsOnFailure) import Hydra.Options import HydraNode ( @@ -151,9 +149,8 @@ spec = around (showLogsOnFailure "EndToEndSpec") $ do { initialUTxOFile = tmpDir "utxo.json" , ledgerGenesisFile = Nothing } - pparams <- loadDefaultPParams -- Start a hydra-node in offline mode and submit a transaction from alice to bob - aliceToBob <- withHydraNode (contramap FromHydraNode tracer) offlineConfig tmpDir 0 aliceSk [] [1] pparams $ \node -> do + aliceToBob <- withHydraNode (contramap FromHydraNode tracer) offlineConfig tmpDir 0 aliceSk [] [1] defaultPParams $ \node -> do let Just (aliceSeedTxIn, aliceSeedTxOut) = UTxO.find (isVkTxOut aliceCardanoVk) initialUTxO let Right aliceToBob = mkSimpleTx @@ -166,7 +163,7 @@ spec = around (showLogsOnFailure "EndToEndSpec") $ do pure aliceToBob -- Restart a hydra-node in offline mode expect we can reverse the transaction (it retains state) - withHydraNode (contramap FromHydraNode tracer) offlineConfig tmpDir 0 aliceSk [] [1] pparams $ \node -> do + withHydraNode (contramap FromHydraNode tracer) offlineConfig tmpDir 0 aliceSk [] [1] defaultPParams $ \node -> do let bobTxOut = toUTxOContext $ txOuts' aliceToBob !! 0 Right bobToAlice = @@ -526,7 +523,7 @@ spec = around (showLogsOnFailure "EndToEndSpec") $ do args <- setupCardanoDevnet tmpDir forkIntoConwayInEpoch tmpDir args 1 withCardanoNode (contramap FromCardanoNode tracer) tmpDir args $ \nodeSocket -> do - pparams <- loadDefaultPParams + let pparams = defaultPParams let node = RunningNode{nodeSocket, networkId = defaultNetworkId, pparams} hydraScriptsTxId <- publishHydraScriptsAs node Faucet chainConfig <- chainConfigFor Alice tmpDir nodeSocket hydraScriptsTxId [] cperiod @@ -546,7 +543,7 @@ spec = around (showLogsOnFailure "EndToEndSpec") $ do args <- setupCardanoDevnet tmpDir forkIntoConwayInEpoch tmpDir args 1 withCardanoNode (contramap FromCardanoNode tracer) tmpDir args $ \nodeSocket -> do - pparams <- loadDefaultPParams + let pparams = defaultPParams let node = RunningNode{nodeSocket, networkId = defaultNetworkId, pparams} hydraScriptsTxId <- publishHydraScriptsAs node Faucet chainConfig <- chainConfigFor Alice tmpDir nodeSocket hydraScriptsTxId [] cperiod