@@ -75,7 +75,6 @@ import Testnet.Process.RunIO (execCli', execCli_, liftIOAnnotated, mkE
7575import Testnet.Property.Assert (assertExpectedSposInLedgerState )
7676import Testnet.Runtime as TR
7777import Testnet.Start.Types
78- import Testnet.TxGenRuntime (startTxGenRuntime )
7978import Testnet.Types as TR hiding (shelleyGenesis )
8079
8180import qualified Hedgehog.Extras as H
@@ -355,11 +354,20 @@ cardanoTestnet
355354 throwString $ " Some nodes failed to start:\n " ++ show (vsep $ prettyError <$> failedNodes)
356355
357356 -- Interrupt cardano nodes when the main process is interrupted
358- liftIOAnnotated $ interruptNodesOnSigINT ( map nodeProcessHandle testnetNodes')
357+ liftIOAnnotated $ interruptNodesOnSigINT testnetNodes'
359358
360359 -- Make sure that all nodes are healthy by waiting for a chain extension
361360 mapConcurrently_ (waitForBlockThrow 45 (File nodeConfigFile)) testnetNodes'
362361
362+ let node1SocketPath = tmpAbsPath </> " socket" </> " node1" </> " sock"
363+ utxoSigningKeyFile = File $ (tmpAbsPath </> ) $ unFile $ signingKey $ Defaults. defaultUtxoKeys 1
364+ nodeDescriptions = NEL. map (\ (i, port) -> NodeDescription (NodeAddress (NodeHostIPv4Address (fromHostAddress testnetDefaultIpv4Address)) port) (Defaults. defaultNodeName i) ) portNumbers
365+
366+ case cardanoEnableTxGenerator testnetOptions of
367+ NoTxGeneratorSupport -> pure ()
368+ GenerateTemplateConfigForTxGenerator ->
369+ generateTxGenConfig tmpAbsPath nodeConfigFile utxoSigningKeyFile node1SocketPath nodeDescriptions
370+
363371 let runtime = TestnetRuntime
364372 { configurationFile = File nodeConfigFile
365373 , shelleyGenesisFile = tmpAbsPath </> Defaults. defaultGenesisFilepath ShelleyEra
@@ -391,24 +399,7 @@ cardanoTestnet
391399 when enableNewEpochStateLogging $
392400 TR. startLedgerNewEpochStateLogging runtime tempBaseAbsPath
393401
394- let node1SocketPath = tmpAbsPath </> " socket" </> " node1" </> " sock"
395- utxoSigningKeyFile = File $ (tmpAbsPath </> ) $ unFile $ signingKey $ Defaults. defaultUtxoKeys 1
396- nodeDescriptions = NEL. map (\ (i, port) -> NodeDescription (NodeAddress (NodeHostIPv4Address (fromHostAddress testnetDefaultIpv4Address)) port) (Defaults. defaultNodeName i) ) portNumbers
397-
398- case cardanoEnableTxGenerator testnetOptions of
399- NoTxGeneratorSupport -> pure ()
400- GenerateTemplateConfigForTxGenerator ->
401- void $ generateTxGenConfig tmpAbsPath nodeConfigFile utxoSigningKeyFile node1SocketPath nodeDescriptions
402- GenerateAndRunTxGenerator -> do
403- configFile <- generateTxGenConfig tmpAbsPath nodeConfigFile utxoSigningKeyFile node1SocketPath nodeDescriptions
404- hProcess <- runRIO () $ startTxGenRuntime (TmpAbsolutePath tmpAbsPath)
405- [ " json_highlevel"
406- , configFile
407- ]
408- liftIOAnnotated $ interruptNodesOnSigINT (hProcess : map nodeProcessHandle testnetNodes')
409-
410402 pure runtime
411-
412403 where
413404 extraCliArgs = \ case
414405 SpoNodeOptions args -> args
@@ -419,10 +410,9 @@ cardanoTestnet
419410 mkTestnetNodeKeyPaths :: Int -> SpoNodeKeys
420411 mkTestnetNodeKeyPaths n = makePathsAbsolute $ Defaults. defaultSpoKeys n
421412
422- generateTxGenConfig :: MonadUnliftIO m => FilePath -> FilePath -> SigningKeyFile 'In -> String -> NonEmpty NodeDescription -> m FilePath
413+ generateTxGenConfig :: MonadUnliftIO m => FilePath -> FilePath -> SigningKeyFile 'In -> String -> NonEmpty NodeDescription -> m ()
423414 generateTxGenConfig basePath nodeConfigFilePath utxoSigningKeyFile localNodeSocketPath nodeTopology = do
424- let file = basePath </> " tx-generator-config.json"
425- nixServiceOptions = NixServiceOptions {
415+ let nixServiceOptions = NixServiceOptions {
426416 _nix_debugMode = False
427417 , _nix_tx_count = 100
428418 , _nix_tps = 10
@@ -441,8 +431,8 @@ cardanoTestnet
441431 , _nix_localNodeSocketPath = localNodeSocketPath
442432 , _nix_targetNodes = nodeTopology
443433 }
444- liftIOAnnotated . LBS. writeFile file $ A. encodePretty nixServiceOptions
445- pure file
434+ liftIOAnnotated . LBS. writeFile (basePath </> " tx-generator-config.json " ) $ A. encodePretty nixServiceOptions
435+ pure ()
446436
447437 -- wait for new blocks or throw an exception if there are none in the timeout period
448438 waitForBlockThrow :: MonadUnliftIO m
0 commit comments