Skip to content

Commit

Permalink
Merge #3638
Browse files Browse the repository at this point in the history
3638: tx-generator: Use multiple named wallets r=deepfire a=MarcFontaine

This PR allows the tx-generator to use multiple named wallets (instead of one global wallet).
This makes it easier to control which UTxO is used when, inside tx-generator scripts.

Co-authored-by: MarcFontaine <MarcFontaine@users.noreply.github.com>
  • Loading branch information
iohk-bors[bot] and MarcFontaine authored Mar 11, 2022
2 parents baa9b5e + a36e340 commit a47cd87
Show file tree
Hide file tree
Showing 17 changed files with 553 additions and 432 deletions.
47 changes: 0 additions & 47 deletions bench/script/test-full-auto.ljson

This file was deleted.

54 changes: 0 additions & 54 deletions bench/script/test-plutus-to-file.ljson

This file was deleted.

55 changes: 0 additions & 55 deletions bench/script/test-plutus.ljson

This file was deleted.

47 changes: 31 additions & 16 deletions bench/tx-generator/src/Cardano/Benchmarking/Command.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,40 @@ where
import Prelude
import System.Exit

import Data.ByteString.Lazy as BSL
import Options.Applicative as Opt

import Ouroboros.Network.NodeToClient (withIOManager)

import Cardano.Benchmarking.Script (runScript, parseScriptFileAeson, parseScriptFileLegacy)
import Cardano.Benchmarking.Compiler (compileOptions)
import Cardano.Benchmarking.NixOptions (parseNixServiceOptions)
import Cardano.Benchmarking.Script (runScript, parseScriptFileAeson)
import Cardano.Benchmarking.Script.Aeson (prettyPrint)

data Command
= Json !FilePath
| LegacyJson !FilePath
= Json FilePath
| JsonHL FilePath
| Compile FilePath

runCommand :: IO ()
runCommand = withIOManager $ \iocp -> do
cmd <- customExecParser
(prefs showHelpOnEmpty)
(info commandParser mempty)
case cmd of
Json file -> do
Json file -> do
script <- parseScriptFileAeson file
runScript script iocp >>= handleError
LegacyJson file -> do
script <- parseScriptFileLegacy file
runScript script iocp >>= handleError
JsonHL file -> do
o <- parseNixServiceOptions file
case compileOptions o of
Right script -> runScript script iocp >>= handleError
err -> handleError err
Compile file -> do
o <- parseNixServiceOptions file
case compileOptions o of
Right script -> BSL.putStr $ prettyPrint script
err -> handleError err
where
handleError :: Show a => Either a b -> IO ()
handleError = \case
Expand All @@ -43,10 +55,7 @@ runCommand = withIOManager $ \iocp -> do

commandParser :: Parser Command
commandParser
= subparser
( jsonCmd
<> legacyJsonCmd
)
= subparser (jsonCmd <> jsonHLCmd <> compileCmd)
where
jsonCmd = command "json"
(Json <$> info (strArgument (metavar "FILEPATH"))
Expand All @@ -55,11 +64,17 @@ commandParser
<> header "tx-generator - run a generic benchmarking script"
)
)

legacyJsonCmd = command "legacy-json"
(LegacyJson <$> info (strArgument (metavar "FILEPATH"))
( progDesc "tx-generator run JsonScript (legacy format)"
jsonHLCmd = command "json_highlevel"
(JsonHL <$> info (strArgument (metavar "FILEPATH"))
( progDesc "tx-generator run Options"
<> fullDesc
<> header "tx-generator - run flat-options"
)
)
compileCmd = command "compile"
(Compile <$> info (strArgument (metavar "FILEPATH"))
( progDesc "tx-generator compile Options"
<> fullDesc
<> header "tx-generator - run a generic benchmarking script (legacy JSON format)"
<> header "tx-generator - compile flat-options to benchmarking script"
)
)
Loading

0 comments on commit a47cd87

Please sign in to comment.