diff --git a/cardano-testnet/cardano-testnet.cabal b/cardano-testnet/cardano-testnet.cabal index 07ebf7336a9..ca38477d18d 100644 --- a/cardano-testnet/cardano-testnet.cabal +++ b/cardano-testnet/cardano-testnet.cabal @@ -50,6 +50,9 @@ library , cardano-ledger-shelley , cardano-node , cardano-ping ^>= 0.4 + , contra-tracer + , containers + , data-default-class , cborg , containers , contra-tracer @@ -60,7 +63,6 @@ library , filepath , hedgehog , hedgehog-extras ^>= 0.6.4 - , iproute , lens-aeson , microlens , mtl diff --git a/cardano-testnet/src/Testnet/Start/Cardano.hs b/cardano-testnet/src/Testnet/Start/Cardano.hs index 6eec9de3a79..9a8fe3b36af 100644 --- a/cardano-testnet/src/Testnet/Start/Cardano.hs +++ b/cardano-testnet/src/Testnet/Start/Cardano.hs @@ -30,10 +30,6 @@ import Cardano.Api.Ledger (StandardCrypto) import Cardano.Ledger.Alonzo.Genesis (AlonzoGenesis) import Cardano.Ledger.Conway.Genesis (ConwayGenesis) import Cardano.Node.Configuration.Topology -import qualified Cardano.Node.Configuration.TopologyP2P as P2P -import qualified Ouroboros.Network.PeerSelection.Bootstrap as P2P -import qualified Ouroboros.Network.PeerSelection.LedgerPeers as P2P -import qualified Ouroboros.Network.PeerSelection.PeerTrustable as P2P import Prelude hiding (lines) @@ -44,7 +40,6 @@ import qualified Data.Aeson as Aeson import Data.Bifunctor (first) import qualified Data.ByteString.Lazy as LBS import Data.Either -import Data.IP as IP import qualified Data.List as L import Data.Maybe import qualified Data.Text as Text @@ -54,7 +49,6 @@ import qualified Data.Time.Clock as DTC import Data.Word (Word64) import GHC.Stack import qualified GHC.Stack as GHC -import qualified System.Directory as IO import System.FilePath (()) import qualified System.Info as OS import Text.Printf (printf) @@ -197,7 +191,8 @@ cardanoTestnet let (CardanoTestnetOptions _cardanoNodes asbe maxSupply _p2p nodeLoggingFormat _numDReps newEpochStateLogging) = testnetOptions startTime = sgSystemStart shelleyGenesis testnetMagic = fromIntegral $ sgNetworkMagic shelleyGenesis - nPools@(NumPools numPoolNodes) = numPools testnetOptions + numPoolNodes = length $ cardanoNodes testnetOptions + nPools = numPools testnetOptions nDReps = numDReps testnetOptions AnyShelleyBasedEra sbe <- pure asbe @@ -236,7 +231,7 @@ cardanoTestnet configurationFile <- H.noteShow . File $ tmpAbsPath "configuration.yaml" - _ <- createSPOGenesisAndFiles 1 nDReps maxSupply asbe shelleyGenesis alonzoGenesis conwayGenesis (TmpAbsolutePath tmpAbsPath) + _ <- createSPOGenesisAndFiles nPools nDReps maxSupply asbe shelleyGenesis alonzoGenesis conwayGenesis (TmpAbsolutePath tmpAbsPath) -- TODO: This should come from the configuration! let poolKeyDir :: Int -> FilePath @@ -244,7 +239,7 @@ cardanoTestnet mkNodeName :: Int -> String mkNodeName i = "pool" <> show i - poolKeys <- H.noteShow $ flip fmap [1..1] $ \n -> + poolKeys <- H.noteShow $ flip fmap [1..numPoolNodes] $ \n -> -- TODO: use Testnet.Defaults.defaultSpoKeys here PoolNodeKeys { poolNodeKeysCold = @@ -313,10 +308,8 @@ cardanoTestnet -- Byron related forM_ (zip [1..] portNumbers) $ \(i, portNumber) -> do let iStr = printf "%03d" (i - 1) - when (i == 1) $ do - H.renameFile (tmpAbsPath "byron-gen-command" "delegate-keys." <> iStr <> ".key") (tmpAbsPath poolKeyDir i "byron-delegate.key") - H.renameFile (tmpAbsPath "byron-gen-command" "delegation-cert." <> iStr <> ".json") (tmpAbsPath poolKeyDir i "byron-delegation.cert") - H.evalIO $ IO.createDirectoryIfMissing True $ tmpAbsPath poolKeyDir i + H.renameFile (tmpAbsPath "byron-gen-command" "delegate-keys." <> iStr <> ".key") (tmpAbsPath poolKeyDir i "byron-delegate.key") + H.renameFile (tmpAbsPath "byron-gen-command" "delegation-cert." <> iStr <> ".json") (tmpAbsPath poolKeyDir i "byron-delegation.cert") H.writeFile (tmpAbsPath poolKeyDir i "port") (show portNumber) -- Make topology files @@ -327,21 +320,9 @@ cardanoTestnet , raPort = otherProducerPort , raValency = 1 } + H.lbsWriteFile (tmpAbsPath poolKeyDir i "topology.json") . encode $ RealNodeTopology producers - -- P2P.RelayAccessAddress - -- (IP.IPv4 $ IP.fromHostAddress testnetDefaultIpv4Address) - -- otherProducerPort - -- rootConfig = P2P.RootConfig peers P2P.DoNotAdvertisePeer - -- peersGroup = P2P.LocalRootPeersGroup rootConfig 2 2 P2P.IsTrustable - -- H.lbsWriteFile (tmpAbsPath poolKeyDir i "topology.json") . encode $ - -- P2P.RealNodeTopology - -- (P2P.LocalRootPeersGroups [peersGroup]) - -- [] - -- (if i == 1 - -- then P2P.DontUseLedgerPeers - -- else P2P.UseLedgerPeers P2P.Always) - -- P2P.DontUseBootstrapPeers let keysWithPorts = L.zip3 [1..] poolKeys portNumbers ePoolNodes <- H.forConcurrently keysWithPorts $ \(i, key, port) -> do @@ -412,7 +393,7 @@ cardanoTestnet stakePoolsFp <- H.note $ tmpAbsPath "current-stake-pools.json" - assertExpectedSposInLedgerState stakePoolsFp 1 execConfig + assertExpectedSposInLedgerState stakePoolsFp nPools execConfig when newEpochStateLogging $ TR.startLedgerNewEpochStateLogging runtime tempBaseAbsPath diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/TreasuryGrowth.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/TreasuryGrowth.hs index 8f128b4dcb7..e7f9e816041 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/TreasuryGrowth.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/TreasuryGrowth.hs @@ -48,7 +48,6 @@ prop_check_if_treasury_is_growing = integrationRetryWorkspace 0 "growing-treasur } TestnetRuntime{testnetMagic, configurationFile, poolNodes} <- cardanoTestnetDefault options shelleyOptions conf - H.failure (execConfig, socketPathAbs) <- do PoolNode{poolRuntime} <- H.headM poolNodes