Skip to content

Eject db-synthesizer and adopt cardano-config - #2141

Closed
jasagredo wants to merge 12 commits into
peras/tweak-peras-vote-idfrom
js/eject-db-synth2
Closed

Eject db-synthesizer and adopt cardano-config#2141
jasagredo wants to merge 12 commits into
peras/tweak-peras-vote-idfrom
js/eject-db-synth2

Conversation

@jasagredo

Copy link
Copy Markdown
Contributor

This PR removes the vendored parser for cardano configuration and instead makes use of cardano-config.

We also eject db-synthesizer which will need to be implemented downstream (cardano-api? ouroboros-consensus-tools?)

Comment thread ouroboros-consensus-cardano/test/tools-test/Main.hs Outdated
Comment thread ouroboros-consensus.cabal
Comment thread cabal.project Outdated
@f-f
f-f force-pushed the f-f/prepare-11.1 branch from e468a93 to 6de6c8a Compare July 30, 2026 10:39
Base automatically changed from f-f/prepare-11.1 to main July 30, 2026 14:08
@jasagredo
jasagredo force-pushed the js/eject-db-synth2 branch from 97dac2a to 9c97459 Compare July 30, 2026 16:43
@jasagredo
jasagredo force-pushed the js/eject-db-synth2 branch 5 times, most recently from 488f7a4 to 81e4645 Compare August 3, 2026 09:23
Replace db-analyser's locally-implemented CardanoConfig JSON parser with
the shared cardano-config package. The genesis file paths, byron network
magic, genesis hashes and hard-fork triggers are now read from
cardano-config's NodeConfigurationFromFile, with small boundary
conversions for the hash/network-magic representations. db-immutaliser
reuses this path via CardanoBlockArgs, so it migrates too.

No behavioural change: the tools-test integration test (synthesise ->
immutalise -> analyse) still passes with matching block counts.
Replace db-synthesizer's locally-implemented config parser with the
shared cardano-config package. 'initialize' now parses the node config
with cardano-config and adapts it into the Node*ProtocolConfiguration
records that mkConsensusProtocolCardano consumes: byron-era settings,
genesis file paths (including Dijkstra via the testing config's
experimental genesis) and the hard-fork triggers.

Removes the local parser entirely: the NodeConfigStub type, the
FromJSON/AdjustFilePaths orphan instances (Orphans.hs) and the
confConfigStub field. Forging credentials still come from the tool's own
CLI NodeCredentials; the byron software version is hard-coded, mirroring
the node, since cardano-config does not model it.

tools-test still passes (synthesise -> immutalise -> analyse).
…utable

Reshape 'synthesize' to accept the (ProtocolInfo, block-forgers) pair
produced by 'protocolInfoCardano', plus the forge options, epoch size and
ChainDB directory directly. Constructing the protocol from a node
configuration is now the caller's responsibility, so 'synthesize' no
longer touches CardanoProtocolParams or the configuration filesystem.

Also remove the standalone db-synthesizer executable (app + CLI parser +
cabal stanza); it will be provided downstream. The tools-test integration
test now builds the protocol itself (initialize + protocolInfoCardano)
and still exercises the full synthesise -> immutalise -> analyse pipeline.

No behavioural change; tools-test still passes.
With the config parsing now handled by cardano-config and synthesize
taking a ready-made ProtocolInfo, db-synthesizer no longer needs the
vendored node/api machinery in-repo. Remove it entirely:

- 'initialize' and its adapters (the genesis/credential reading and
  protocol assembly) leave; they belong downstream, built on cardano-api.
- Delete the vendored Cardano.Api.*, Cardano.Node.Protocol.* and
  Cardano.Node.Types modules (no remaining consumers), and prune the
  now-unused build-depends (base16-bytestring, cardano-crypto,
  transformers-except).
- Trim DBSynthesizer.Types to the node/api-free option types.

The tools-test integration test becomes synthesis-only: it builds a
forging-capable protocol via the testlib (new
mkSimpleTestProtocolInfoForging, which also returns the block forgers and
genesis) instead of a node configuration file, and forges within the
testlib's KES validity window. The config-driven
synthesise -> immutalise -> analyse pipeline (and the executable) move
downstream. Drop the now-unused config fixtures.

All tool executables, cardano-test and tools-test still build and pass.
--in-mem/--lsm are now optional; when neither is given, the backend and its
settings come from the LedgerDB section of the node configuration file. The
protocol info and the backend are read in one go so the configuration is only
resolved once.
Exports every snapshot taken with --store-ledger into <db>/lsm-exported.
…arsing

Restore the node configuration fixtures and test what db-analyser derives from
them: hard-fork triggers, initial nonce and LedgerDB backend. Variants are
patched into a temp dir rather than checked in.

All configuration problems are now a ConfigError, including the ones
cardano-config throws, and the tools print them as a plain message.
mkHardForkTriggers and mkLedgerDBBackend became total; the latter rejects
absolute LSM paths, which cannot be honoured inside the ChainDB.

Also give mkProtocolInfo a default so the MINIMAL pragma is meaningful, take
the ShelleyGenesis in synthesize instead of a bare epoch size, and drop a stale
db-synthesizer reference from the release docs.
Asserting only "> 0" would not notice a regression in the forging loop or the
leader schedule, both of which are deterministic here. Record why the create and
append counts differ, and how to re-baseline them.
Drop the keys cardano-config no longer knows (ApplicationName,
ApplicationVersion, EnableP2P and the two TestEnableDevelopment* gates, since
renamed to Experimental{HardForks,Protocols}Enabled upstream), then reshape the
file into the { $schema, Version, Configuration } envelope. db-analyser reads
none of the dropped keys.

The configuration now resolves with no warnings at all, so assert that rather
than just that our own keys are recognised. Variants are patched into their
section under Configuration: a key left at the top level would make
cardano-config treat the whole file as legacy and migrate it, quietly testing
the wrong path, so the helper rejects such a path and every successful
resolution asserts the file needed no migration.
@jasagredo
jasagredo force-pushed the js/eject-db-synth2 branch from 9c0fb60 to 8ad4b4d Compare August 6, 2026 13:09
@jasagredo
jasagredo changed the base branch from main to peras/tweak-peras-vote-id August 6, 2026 13:10
An error occurred while trying to automatically change base from peras/tweak-peras-vote-id to peras/use-injective-type-families August 6, 2026 14:03
@jasagredo

Copy link
Copy Markdown
Contributor Author

Superseded by #2259

@jasagredo jasagredo closed this Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants