cardano-testnet: Add backwards-compatibility with some old cli/node versions#6543
Open
cardano-testnet: Add backwards-compatibility with some old cli/node versions#6543
Conversation
Adapt to the cli version automatically
carbolymer
reviewed
Apr 21, 2026
carbolymer
reviewed
Apr 21, 2026
carbolymer
reviewed
Apr 21, 2026
Jimbo4350
requested changes
Apr 23, 2026
Contributor
Jimbo4350
left a comment
There was a problem hiding this comment.
To clarify my earlier message. By "from this cardano-testnet onwards" I meant: make the current cardano-testnet work with the current cardano-cli release. That's the scope. I wasn't asking for a flag and backport mechanism or for us to collect past configurations. Since cardano-testnet has never been officially released there's no installed base to support, so we don't need a backwards compatibility path at all. We need forward compatibility with whatever cli is current.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Makes
cardano-testnetwork seamlessly with older versions ofcardano-cliandcardano-node(not all versions, just to some extent), without hard-coded version checks. The code probes the installed CLI's capabilities at runtime and adapts automatically — genesis files that the CLI doesn't produce are created via fallback, and the node configuration includes settings needed by older nodes.Motivation: We aim to allow for
cardano-testnetto run testnet with different versions of thecardano-node. This PR makes that easier, since we will only have to worry about running the correct node, and not about having the right configuration files generated.What changed:
RunIO.hs):getCliHelpTextprobescardano-cli <era> genesis create-testnet-data --helpto discover which--spec-*flags are supported.Configuration.hs):specFlagtakes a(String -> Bool)predicate and only passes flags the CLI advertises. Adding a future era is one extra++ specFlag cliHas NewEraline.Configuration.hs): When the CLI doesn't producebyron-genesis.json(older CLIs don't), it is created via the existingcreateByronGenesisfromByron.hs, with delegate keys copied into the expected pool-key directories.Configuration.hs): Whendijkstra-genesis.jsonis missing, the default is written directly so that the node configuration and hash computation stay uniform.Byron.hsconstraint relaxation:createByronGenesisnow requires onlyMonadIO(wasMonadTest, MonadCatch, MonadIO) and usesTestnet.Process.RunIO.execCli_, so it can be called from both production code and tests.EnableP2Pin config (Defaults.hs): Older nodes (≤ 9.x) requireEnableP2P: Trueexplicitly to parse P2P topology files; newer nodes already default to P2P so the flag is harmless.Tests with old versions of
cardano-nodeandcardano-clibefore this PR and after this PR:Checklist
See Running tests for more details
CHANGELOG.mdfor affected package.cabalfiles are updatedhlint. See.github/workflows/check-hlint.ymlto get thehlintversionstylish-haskell. See.github/workflows/stylish-haskell.ymlto get thestylish-haskellversionghc-9.6andghc-9.12