diff --git a/CHANGELOG.md b/CHANGELOG.md index 75d8bee3f63..5799e1411ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,9 @@ changes. `HandshakeFailure` event will be recorded in the logs and sent as a server output on the API. +- Make `hydra-cluster --devnet` more configurable + - Now it is idle by default again and a `--busy` will make it busy respending the same UTxO. + ## [0.16.0] - 2024-04-03 - Tested with `cardano-node 8.9.0`, `cardano-cli 8.20.3.0` and `mithril 2412.0`. diff --git a/hydra-cluster/exe/hydra-cluster/Main.hs b/hydra-cluster/exe/hydra-cluster/Main.hs index 77d7abc53f9..0f21ac61d65 100644 --- a/hydra-cluster/exe/hydra-cluster/Main.hs +++ b/hydra-cluster/exe/hydra-cluster/Main.hs @@ -6,7 +6,7 @@ import CardanoNode (findRunningCardanoNode, waitForFullySynchronized, withCardan import Hydra.Cluster.Faucet (publishHydraScriptsAs) import Hydra.Cluster.Fixture (Actor (Faucet)) import Hydra.Cluster.Mithril (downloadLatestSnapshotTo) -import Hydra.Cluster.Options (Options (..), PublishOrReuse (Publish, Reuse), UseMithril (UseMithril), parseOptions) +import Hydra.Cluster.Options (Options (..), PublishOrReuse (Publish, Reuse), Scenario (..), UseMithril (UseMithril), parseOptions) import Hydra.Cluster.Scenarios (EndToEndLog (..), respendUTxO, singlePartyHeadFullLifeCycle, singlePartyOpenAHead) import Hydra.Logging (Verbosity (Verbose), traceWith, withTracer) import Options.Applicative (ParserInfo, execParser, fullDesc, header, helper, info, progDesc) @@ -34,11 +34,14 @@ run options = withCardanoNodeDevnet fromCardanoNode workDir $ \node -> do txId <- publishOrReuseHydraScripts tracer node singlePartyOpenAHead tracer workDir node txId $ \client walletSk -> do - -- Start respending the same UTxO with a 100ms delay. - -- XXX: Should make this configurable - respendUTxO client walletSk 0.1 + case scenario of + Idle -> forever $ pure () + RespendUTxO -> do + -- Start respending the same UTxO with a 100ms delay. + -- XXX: Should make this configurable + respendUTxO client walletSk 0.1 where - Options{knownNetwork, stateDirectory, publishHydraScripts, useMithril} = options + Options{knownNetwork, stateDirectory, publishHydraScripts, useMithril, scenario} = options withRunningCardanoNode tracer workDir network action = findRunningCardanoNode (contramap FromCardanoNode tracer) workDir network >>= \case diff --git a/hydra-cluster/src/Hydra/Cluster/Options.hs b/hydra-cluster/src/Hydra/Cluster/Options.hs index 650f7334dcb..d039194dee7 100644 --- a/hydra-cluster/src/Hydra/Cluster/Options.hs +++ b/hydra-cluster/src/Hydra/Cluster/Options.hs @@ -12,6 +12,7 @@ data Options = Options , stateDirectory :: Maybe FilePath , publishHydraScripts :: PublishOrReuse , useMithril :: UseMithril + , scenario :: Scenario } deriving stock (Show, Eq, Generic) deriving anyclass (ToJSON, FromJSON) @@ -24,6 +25,10 @@ data UseMithril = NotUseMithril | UseMithril deriving stock (Show, Eq, Generic) deriving anyclass (ToJSON, FromJSON) +data Scenario = Idle | RespendUTxO + deriving stock (Show, Eq, Generic) + deriving anyclass (ToJSON, FromJSON) + parseOptions :: Parser Options parseOptions = Options @@ -31,6 +36,7 @@ parseOptions = <*> parseStateDirectory <*> parsePublishHydraScripts <*> parseUseMithril + <*> parseScenario where parseKnownNetwork = flag' (Just Preview) (long "preview" <> help "The preview testnet") @@ -86,3 +92,11 @@ parseOptions = \If not set, the cardano-node will synchronize the network given the current \ \cardano-node state in --state-directory." ) + + parseScenario = + flag + Idle + RespendUTxO + ( long "busy" + <> help "Start respending the same UTxO with a 100ms delay (only for devnet)." + )