Skip to content

cardano-testnet: Add --nodes flag for per-node binary configuration#6559

Open
palas wants to merge 3 commits intomasterfrom
testnet-specify-node-bin-per-node
Open

cardano-testnet: Add --nodes flag for per-node binary configuration#6559
palas wants to merge 3 commits intomasterfrom
testnet-specify-node-bin-per-node

Conversation

@palas
Copy link
Copy Markdown
Contributor

@palas palas commented May 6, 2026

Description

Adds a --nodes CLI flag to cardano-testnet that allows specifying the role (SPO or relay) and optionally a custom cardano-node binary for each node in the testnet. This enables running testnets with mixed node versions, which is needed for testing compatibility across node releases.

The new flag coexists with the existing --num-pool-nodes via <|> in the parser, so either can be used:

--nodes spo,spo:node-bin=/path/to/custom-node,relay,relay
--num-pool-nodes 3   # unchanged, still works

At creation time, custom binaries are validated by running --version and the result is recorded in a YAML env file (node-data/nodeN/env). At runtime, the env file is read to resolve the binary, falling back to the default resolution when no env file exists.

The NodeOption type was refactored from a sum type (SpoNodeOptions | RelayNodeOptions) into a record, and a new TestnetNodeOptions container enforces at the type level that there is at least one SPO (NonEmpty) and that SPOs come before relays (by structure). The parser also validates this ordering.

readNodeOptionsFromEnv now validates that node directories are consecutively numbered and that SPOs come before relays, matching the assumptions made by cardanoTestnet.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated. These may include:
    • golden tests
    • property tests
    • roundtrip tests
    • integration tests
      See Running tests for more details
  • Any changes are noted in the CHANGELOG.md for affected package
  • The version bounds in .cabal files are updated
  • CI passes. See note on CI. The following CI checks are required:
    • Code is linted with hlint. See .github/workflows/check-hlint.yml to get the hlint version
    • Code is formatted with stylish-haskell. See .github/workflows/stylish-haskell.yml to get the stylish-haskell version
    • Code builds on Linux, MacOS and Windows for ghc-9.6 and ghc-9.12
  • Self-reviewed the diff

@palas palas requested a review from a team as a code owner May 6, 2026 01:59
@palas palas self-assigned this May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant