Drastically reduce the cardano-api vendored modules in preparation for dependency inversion - #2082
Closed
jasagredo wants to merge 2 commits into
Closed
Drastically reduce the cardano-api vendored modules in preparation for dependency inversion#2082jasagredo wants to merge 2 commits into
jasagredo wants to merge 2 commits into
Conversation
Add a minimal, Consensus-native implementation of the cardano-api and
cardano-node functionality that the db-tools need (reading genesis files,
loading forging credentials, assembling a Cardano protocol), so that the
unstable-cardano-tools sublib no longer has to vendor copies of those
modules.
This lives in a small namespace in the cardano sublib:
* Ouroboros.Consensus.Cardano.Api.Serialise -- HasTypeProxy/AsType, raw
bytes and CBOR (de)serialisation, Error/FileError, the TextEnvelope
file reader and the deriving-via helpers.
* Ouroboros.Consensus.Cardano.Api.Keys -- the Key interface and the four
key roles actually used (StakePoolKey, VrfKey, UnsoundPureKesKey,
ByronKey), plus OperationalCertificate.
* Ouroboros.Consensus.Cardano.Api.Genesis -- GenesisFile/GenesisHash,
ProtocolFilepaths, the polymorphic genesis reader shared by the
Shelley-based eras, the Byron genesis reader, the Byron and Praos
leader-credential loaders and genesisHashToPraosNonce.
Only the surface transitively reachable from what the tools call is kept:
bech32, the unused key roles, key generation, cast-role classes, the
operational-certificate issue counter and the dead genesis validation are
all omitted.
…red copies
Point the db-tools at the new Ouroboros.Consensus.Cardano.Api.* modules and
remove the vendored cardano-api/cardano-node copies:
* mkConsensusProtocolCardano now imports the genesis readers, credential
loaders, genesisHashToPraosNonce and error types from
Ouroboros.Consensus.Cardano.Api.Genesis, and Error/displayError from
Ouroboros.Consensus.Cardano.Api.Serialise.
* Cardano.Node.Types keeps only the per-era protocol configuration
records (the inputs to mkConsensusProtocolCardano) and re-exports
GenesisFile/GenesisHash/ProtocolFilepaths from the sublib.
* DBSynthesizer.Run gets displayError from the sublib.
Delete the now-unused vendored Cardano.Api.* and
Cardano.Node.Protocol.{Byron,Shelley,Alonzo,Conway} modules, and drop the
build-depends (base16-bytestring, cardano-crypto) that only they used.
jasagredo
force-pushed
the
js/port-cardano-api
branch
from
June 18, 2026 17:18
e36095c to
f07e465
Compare
Contributor
Author
|
Superseded by #2087 |
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.
Subtle errors are lurking in these functions. This is preparatory work for cardano-api to get these definitions from Consensus instead of Consensus vendoring modules that get out of data.
Based on #2043