Skip to content

cardano-testnet: Split testnet options into purpose-specific types#6552

Draft
palas wants to merge 2 commits intomasterfrom
split-refactor-testnet-options
Draft

cardano-testnet: Split testnet options into purpose-specific types#6552
palas wants to merge 2 commits intomasterfrom
split-refactor-testnet-options

Conversation

@palas
Copy link
Copy Markdown
Contributor

@palas palas commented Apr 24, 2026

Description

Split the monolithic CardanoTestnetOptions record into purpose-specific types so that:

  1. --node-env and --num-pool-nodes are structurally mutually exclusive in the CLI parser (via <|>, not optional fields that silently coexist).
  2. No dummy/unused values are passed between call sites — each function receives only the fields it actually uses.
  3. The type structure matches the three real execution modes: create-only (create-env), create-and-run (cardano), and run-from-existing-env (cardano --node-env).

New type structure

  • TestnetCreationOptions — everything needed to create a testnet environment: nodes, era, max supply, num DReps, genesis options, on-chain params. Has a Default instance for tests.
  • TestnetRuntimeOptions — everything needed to run nodes: epoch state logging, gRPC, KES source. Has a Default instance for tests.
  • TestnetEnvOptions--node-env path + timestamp update policy.
  • CardanoTestnetCliOptions — sum type: StartFromScratch StartFromScratchOptions | StartFromEnv StartFromEnvOptions, making the two modes exclusive at the type level.

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 April 24, 2026 19:35
@palas palas self-assigned this Apr 24, 2026
@palas palas marked this pull request as draft April 24, 2026 19:37
@palas palas force-pushed the split-refactor-testnet-options branch from 8d63e40 to 28e37a0 Compare April 24, 2026 19:45
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