Skip to content

Add --testnet-config-dir flag to tx-generator json_highlevel #6513

@palas

Description

@palas

Context

Part 2 of #6510. Depends on #6517.

Adds a --testnet-config-dir flag to tx-generator json_highlevel that auto-discovers the 4 infrastructure config fields from a cardano-testnet output directory. Discovered infrastructure always overrides any user-provided values for those fields; all other config fields must be supplied by the user.

See #6510 for the full design.

Changes

New: bench/tx-generator/src/Cardano/TxGenerator/Setup/TestnetDiscovery.hs

Discovery:

  • Scan testnet dir for node ports, socket path, signing key, config file (using Cardano.Node.Testnet.Paths)
  • Localhost assumption documented in code (matches testnetDefaultIpv4Address in Testnet.Types)
  • Discovered infrastructure (socket path, signing key, node config file, target nodes) always overrides user-provided values

Modify: bench/tx-generator/src/Cardano/Benchmarking/Command.hs

  • New JsonHLSource ADT (FullConfig | TestnetSource) as alternative in parser
  • Updated handler dispatching to discoverTestnetConfig

Modify: bench/tx-generator/tx-generator.cabal

  • Add directory to build-depends
  • Add Cardano.TxGenerator.Setup.TestnetDiscovery to exposed-modules
  • Note: cardano-node is already a dependency (needed for Cardano.Node.Testnet.Paths)

New: tests

  • Mock testnet directory test (generated programmatically from Cardano.Node.Testnet.Paths)
  • Round-trip test (NixServiceOptions → JSON → NixServiceOptions)
  • Property-based test verifying infrastructure fields always override user-provided values

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions