Skip to content

Commit

Permalink
Remove pparams file and use default ones when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
v0d1ch committed Dec 24, 2023
1 parent 32676cd commit ac73f6b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 15 deletions.
1 change: 0 additions & 1 deletion hydra-cluster/config/pparams.json

This file was deleted.

1 change: 0 additions & 1 deletion hydra-cluster/hydra-cluster.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions hydra-cluster/src/Hydra/Cluster/Fixture.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
13 changes: 5 additions & 8 deletions hydra-cluster/test/Test/EndToEndSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -71,7 +71,6 @@ import Hydra.Cluster.Fixture (
carolVk,
cperiod,
defaultNetworkId,
loadDefaultPParams,
)
import Hydra.Cluster.Scenarios (
EndToEndLog (..),
Expand All @@ -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 (
Expand Down Expand Up @@ -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
Expand All @@ -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 =
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit ac73f6b

Please sign in to comment.