Write genesis data into legacy fields instead of extraConfig, fixing silently empty testnets on older nodes - #1420
Draft
carbolymer wants to merge 1 commit into
Draft
Conversation
Reverts the writer side of #1384. `genesis create`, `genesis create-staked` and `genesis create-testnet-data` write initial funds, stake pools, stake credentials, delegations and initial DReps into the top-level `initialFunds`/`staking` (Shelley) and `delegs`/`initialDReps` (Conway) fields again, not into `extraConfig`. Nodes built with cardano-ledger-shelley < 1.19 do not know `extraConfig` and silently ignore it, so a testnet created with cardano-cli 11.2.0.0 starts with an empty UTxO set and no genesis staking, without any error. The switch to `extraConfig` also brought no benefit: cardano-cli only ever emitted inline (`EmbeddedInjection`) data, which the ledger treats identically to the legacy fields. The streaming benefit only exists for file-based injection, which nothing uses yet. The writers now set `sgExtraConfig`/`cgExtraConfig` to `SNothing` explicitly: cardano-api's genesis template defaults populate them with empty injections, which would otherwise leak an empty `extraConfig` block into the output. This also means a template-supplied `extraConfig` is discarded rather than passed through - it would conflict with the generated legacy fields at node startup.
carbolymer
force-pushed
the
mgalazyn/genesis-extraconfig-compat
branch
from
August 17, 2026 14:15
a9a45bd to
be94c1c
Compare
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.
Reverts the writer side of #1384.
genesis create,genesis create-stakedandgenesis create-testnet-datawrite initial funds, stake pools, stake credentials, delegations and initial DReps into the top-levelinitialFunds/staking(Shelley) anddelegs/initialDReps(Conway) fields again, not intoextraConfig.Nodes built with cardano-ledger-shelley < 1.19 do not know
extraConfigand silently ignore it, so a testnet created with cardano-cli 11.2.0.0 starts with an empty UTxO set and no genesis staking, without any error. The switch toextraConfigalso brought no benefit: cardano-cli only ever emitted inline (EmbeddedInjection) data, which the ledger treats identically to the legacy fields. The streaming benefit only exists for file-based injection, which nothing uses yet.The writers now set
sgExtraConfig/cgExtraConfigtoSNothingexplicitly: cardano-api's genesis template defaults populate them with empty injections, which would otherwise leak an emptyextraConfigblock into the output. This also means a template-suppliedextraConfigis discarded rather than passed through - it would conflict with the generated legacy fields at node startup.Context
The bug was found when a nightly testnet run against cli master came up "healthy" but with
initialFunds: {}and all funds underextraConfig.initialFunds.data, which the node silently dropped. The first visible symptom is a funding transaction failing much later with no TxIns available - there is no error anywhere in between.The compatibility boundary: cardano-ledger-shelley 1.19.0.0 (which introduces
extraConfig) reached CHaP on 2026-07-29 as part of the node 11.1 dependency batch, so nodes <= 11.0.x are affected, while nodes on ledger >= 1.19 read either shape. Older ledgers parse the genesis with plain aesonwithObject, which never rejects unknown keys, hence the silence.The revert is lossless for every ledger that exists today: ledger's
resolveInjectionSourceconverts legacy fields into exactly theEmbeddedInjectionvalue the cli was constructing by hand. The legacy fields carry no deprecation pragma andinitialFundsremains a mandatory key in ledger'sFromJSON. The ledger's dual-read path is marked as transitional (TODO: remove this once we move over to the extraConfig fields exclusively), soextraConfigoutput should be reintroduced behind an explicit option once file-based streaming injection is actually used and old nodes are no longer a concern. Ideally, when the ledger drops the legacy migration, populated legacy fields should become a startup error rather than being ignored, so this failure mode stays loud.How to trust this PR
The source changes are a byte-for-byte reversal of a91953c's hunks (verified against
git show a91953cd4), plus the four explicitSNothingfield updates and the removal of now-unused imports and build-depends.All 689 cardano-cli-golden and 72 cardano-cli-test tests pass via the nix checks, and the build is clean under
-Werror.To observe the fixed behaviour:
Expected:
initialFunds: 3,pools: 1,stake: 1,hasExtraConfig: false(on 11.2.0.0 this yieldsinitialFunds: 0andhasExtraConfig: true). The conway genesis likewise no longer contains anextraConfigkey.A sweep of cardano-node, cardano-api and cardano-testnet found no consumer that hand-parses
extraConfigfrom genesis JSON; all consumption goes through ledger types, which accept both shapes.Checklist
.changes/