Skip to content

Use cardano-config to read the node configuration - #6671

Open
jasagredo wants to merge 2 commits into
masterfrom
js/cardano-config-2
Open

Use cardano-config to read the node configuration#6671
jasagredo wants to merge 2 commits into
masterfrom
js/cardano-config-2

Conversation

@jasagredo

Copy link
Copy Markdown
Contributor

Add your description here, if it fixes a particular issue please provide a
link
to the issue.

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
    • cardano-node-chairman, cardano-submit-api and cardano-testnet instead need a
      changelog fragment in <package>/.changes/, because their CHANGELOG.md is generated
      from fragments at release time. Copy _TEMPLATE.yml from that directory, or run
      nix run github:input-output-hk/cardano-dev#herald -- new
  • 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

Note on CI

If your PR is from a fork, the necessary CI jobs won't trigger automatically for security reasons.
You will need to get someone with write privileges. Please contact IOG node developers to do this
for you.

The node now recognises two configuration dialects and picks the parser
each one calls for:

  * a legacy (pre-cardano-config) configuration is resolved with the
    node's own POM parser, as before, and additionally with
    cardano-config (which migrates it on the fly). The node runs on the
    POM result; every field the two parsers disagree on is traced as a
    non-fatal warning at startup, so the two can be reconciled before POM
    is dropped.

  * a cardano-config envelope configuration ({ $schema, Version,
    Configuration }) is resolved with cardano-config alone. The POM
    parser cannot read one at all — every setting lives nested under
    Configuration, so POM sees a document with none of the keys it
    requires — so it is not run, and a failure on this path is fatal
    rather than a warning: there is no second parser to fall back to.
    Its tracing configuration is resolved along with the rest and handed
    to initTraceDispatcher, since trace-dispatcher's own file parser
    would not find the tracing keys inside the envelope either.

CardanoConfigAdapter maps a cardano-config-resolved configuration onto
the node's own NodeConfiguration; CardanoConfigCompare diffs two of
those field by field; CardanoConfigResolve classifies the file and
dispatches. Fields the adapter cannot populate are listed in
adapterGaps, and each shows up concretely as a divergence in the
legacy cross-check.
@jasagredo
jasagredo requested a review from a team as a code owner September 1, 2026 12:54
cardano-node grows migrate/schema/resolve, spliced from the shared
cardano-config:commands sublibrary. migrate and schema are
cardano-config's own commands unchanged; resolve is a node-specific
variant that, for a legacy configuration, additionally re-resolves it
with the node's own parser and reports any discrepancy (exiting non-zero
when they disagree), so it doubles as a CI parity check while the node
still has two parsers. On an envelope configuration there is nothing to
cross-check against and it says so.

The test suite covers both dialects on a fixture configuration carried
in both forms — config.json and the config-envelope.json that
`cardano-node migrate` produces from it — asserting that the legacy
form's parser divergences stay inside the documented residual set, that
the envelope is classified as one and genuinely defeats the POM parser,
and that migrating does not change what the configuration resolves to.
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