Skip to content

Node 10.7 integration#1050

Open
geo2a wants to merge 24 commits intomasterfrom
geo2a/10.7-integration
Open

Node 10.7 integration#1050
geo2a wants to merge 24 commits intomasterfrom
geo2a/10.7-integration

Conversation

@geo2a
Copy link

@geo2a geo2a commented Dec 9, 2025

Changelog

- description: |
    Integrate new Ledger and Consensus packages for Node 10.7.
  type:
  - breaking
  projects:
  - cardano-api

Context

This PR brings the new Ledger and Consensus packages and attempts to integrate them into cardano-api.

How to trust this PR

Review the dependency bumps and any type-level changes required to accommodate the new Ledger/Consensus APIs.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated. See Running tests for more details
  • Self-reviewed the diff

@geo2a geo2a force-pushed the geo2a/10.7-integration branch from 6938982 to e695dcc Compare December 9, 2025 15:51
@geo2a geo2a force-pushed the geo2a/10.7-integration branch from 2f79591 to 463b9e8 Compare December 22, 2025 14:42
@geo2a geo2a force-pushed the geo2a/10.7-integration branch from 463b9e8 to eed7d01 Compare January 2, 2026 08:58
@carbolymer carbolymer force-pushed the geo2a/10.7-integration branch from 0679166 to ae8a93f Compare January 5, 2026 07:52
, Plutus.EraPlutusContext (ShelleyLedgerEra era)
, L.Script (ShelleyLedgerEra era) ~ L.AlonzoScript (ShelleyLedgerEra era)
, L.ScriptsNeeded (ShelleyLedgerEra era) ~ L.AlonzoScriptsNeeded (ShelleyLedgerEra era)
, L.ShelleyEraTxCert (ShelleyLedgerEra era)
Copy link
Contributor

@carbolymer carbolymer Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% convinced about this change. Depending on the legacy certificates support, we might need to revert this and split AlonzoEraOnwardsConstraints into two:

  1. from Alonzo to Conway including ShelleyEraTxCert
  2. from Dijkstra onwards.

This needs to be double checked and if anything pops out during cardano-cli integration.

@geo2a geo2a self-assigned this Jan 30, 2026
@geo2a geo2a force-pushed the geo2a/10.7-integration branch 2 times, most recently from 91d8ca3 to 12fbb1e Compare February 2, 2026 16:00
@geo2a geo2a force-pushed the geo2a/10.7-integration branch from 12fbb1e to 88149e9 Compare February 6, 2026 08:25
@Jimbo4350 Jimbo4350 mentioned this pull request Feb 9, 2026
3 tasks
@geo2a geo2a force-pushed the geo2a/10.7-integration branch 6 times, most recently from 6227b26 to 89109c0 Compare February 12, 2026 18:13
@geo2a geo2a force-pushed the geo2a/10.7-integration branch 3 times, most recently from 46864d5 to 8711784 Compare February 19, 2026 10:07
@geo2a geo2a force-pushed the geo2a/10.7-integration branch from 8711784 to c476239 Compare February 19, 2026 11:26
@geo2a geo2a force-pushed the geo2a/10.7-integration branch 3 times, most recently from fd21353 to 71e925a Compare February 26, 2026 10:00
@geo2a geo2a force-pushed the geo2a/10.7-integration branch 2 times, most recently from 0dab4b5 to 5407021 Compare February 26, 2026 18:00
@geo2a geo2a force-pushed the geo2a/10.7-integration branch from a900ea3 to 3aa87d5 Compare March 17, 2026 14:57
@Jimbo4350 Jimbo4350 requested a review from Copilot March 17, 2026 15:46
@geo2a geo2a marked this pull request as ready for review March 17, 2026 15:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Integrates updated Ledger/Consensus packages (Node 10.7) into the API surface by updating dependencies, adapting to new ledger types/roles, and adjusting genesis/query/tx plumbing accordingly.

Changes:

  • Updated cabal/Nix dependencies to newer ouroboros-*, cardano-ledger-*, and related packages.
  • Refactored API + tests for new ledger types (e.g., TopTx, Guard, AccountAddress, stake pool params rename) and new/relocated cost model configuration.
  • Extended query support (ledger peer snapshots variants, DRep delegations) and updated various conversions/serialisation.

Reviewed changes

Copilot reviewed 70 out of 71 changed files in this pull request and generated no comments.

Show a summary per file
File Description
flake.nix Switches consensus dependency for dev shell builds
cardano-rpc/test/cardano-rpc-test/Test/Cardano/Rpc/ProtocolParameters.hs Updates protocol param lenses/types used in roundtrip property
cardano-rpc/src/Cardano/Rpc/Server/Internal/UtxoRpc/Type.hs Updates protocol param conversions for new ledger representations
cardano-rpc/cardano-rpc.cabal Adds errors dependency for new helpers
cardano-api/test/cardano-api-test/files/input/genesis/spec.alonzo-v2-cost-model-map-175.json Updates golden genesis JSON structure for cost models
cardano-api/test/cardano-api-test/files/input/genesis/spec.alonzo-v2-cost-model-array-175.json Updates golden genesis JSON structure for cost models
cardano-api/test/cardano-api-test/Test/Cardano/Api/Transaction/Autobalance.hs Adapts tests to AccountAddress return address
cardano-api/test/cardano-api-test/Test/Cardano/Api/Genesis.hs Adjusts default cost model access & genesis parsing
cardano-api/test/cardano-api-test/Test/Cardano/Api/Experimental.hs Updates experimental tests for TopTx and renamed fields
cardano-api/test/cardano-api-test/Test/Cardano/Api/EpochLeadership.hs Adapts epoch leadership test types (NonZero Coin)
cardano-api/test/cardano-api-test/Test/Cardano/Api/Crypto.hs Updates DSIGN size API usage
cardano-api/test/cardano-api-golden/Test/Golden/Cardano/Api/Genesis.hs Aligns golden genesis types with renamed key roles
cardano-api/src/Cardano/Api/Tx/Internal/Sign.hs Moves to Tx TopTx and TxBody TopTx types
cardano-api/src/Cardano/Api/Tx/Internal/Output.hs Updates output conversions for new tx body type
cardano-api/src/Cardano/Api/Tx/Internal/Fee.hs Moves to Tx TopTx and updated credential roles
cardano-api/src/Cardano/Api/Tx/Internal/Body/Lens.hs Changes validity interval lenses to StrictMaybe
cardano-api/src/Cardano/Api/Tx/Internal/Body.hs Updates tx body conversions + introduces asGuard helper
cardano-api/src/Cardano/Api/Query/Internal/Type/QueryInMode.hs Adds new query variants and updates peer snapshot decoding
cardano-api/src/Cardano/Api/Query/Internal/Expr.hs Exposes new query helpers and peer snapshot kind parameter
cardano-api/src/Cardano/Api/Query.hs Renames exported peer snapshot decoder
cardano-api/src/Cardano/Api/ProtocolParameters.hs Adapts protocol params update types + compact conversions
cardano-api/src/Cardano/Api/Plutus/Internal/Script.hs Upgrades timelocks for Dijkstra scripts
cardano-api/src/Cardano/Api/Network/Internal/Reexport.hs Reexports peer snapshot kind/types
cardano-api/src/Cardano/Api/Network/IPC/Internal/Version.hs Switches NodeToClient version import path
cardano-api/src/Cardano/Api/Network/IPC/Internal/ChainSync/Client.hs Switches NodeToClient import path
cardano-api/src/Cardano/Api/Network/IPC/Internal.hs Switches NodeToClient import path and aliases
cardano-api/src/Cardano/Api/Network.hs Reexports new network peer snapshot types
cardano-api/src/Cardano/Api/LedgerState/Internal/Rule/BBODY/UTXOW.hs Refactors UTXOW event handling to LambdaCase
cardano-api/src/Cardano/Api/LedgerState/Internal/LedgerEvent.hs Updates credential role types in events
cardano-api/src/Cardano/Api/LedgerState.hs Updates key roles and ledger table extraction plumbing
cardano-api/src/Cardano/Api/Ledger/Internal/Reexport.hs Updates reexports for renamed ledger symbols
cardano-api/src/Cardano/Api/Key/Internal/Class.hs Updates RNG bytestring generation function
cardano-api/src/Cardano/Api/Key/Internal.hs Updates genesis key role types
cardano-api/src/Cardano/Api/Internal/Orphans/Serialisation.hs Adds/changes JSON instances for updated ledger types
cardano-api/src/Cardano/Api/Internal/Orphans/Misc.hs Updates Semigroup instances for renamed fee fields
cardano-api/src/Cardano/Api/Governance/Internal/Action/ProposalProcedure.hs Updates governance action/withdrawal address types
cardano-api/src/Cardano/Api/Genesis/Internal.hs Restructures Alonzo genesis defaults & exports V1 model
cardano-api/src/Cardano/Api/Genesis.hs Reexports defaultV1CostModel
cardano-api/src/Cardano/Api/Experimental/Tx/Internal/Type.hs Updates experimental tx wrappers to Tx TopTx
cardano-api/src/Cardano/Api/Experimental/Tx/Internal/Fee.hs Updates experimental fee evaluation tx type
cardano-api/src/Cardano/Api/Experimental/Tx/Internal/Certificate/Compatible.hs Renames PoolParams -> StakePoolParams
cardano-api/src/Cardano/Api/Experimental/Tx/Internal/Certificate.hs Updates pool metadata hash types/conversions
cardano-api/src/Cardano/Api/Experimental/Tx/Internal/BodyContent/New.hs Adapts experimental tx builder for new types/roles
cardano-api/src/Cardano/Api/Experimental/Tx.hs Updates tx hashing + signed tx type to TopTx
cardano-api/src/Cardano/Api/Experimental/Simple/Script.hs Simplifies annotator application
cardano-api/src/Cardano/Api/Experimental/Plutus/Internal/Shim/LegacyScripts.hs Upgrades timelocks for Dijkstra in legacy shim
cardano-api/src/Cardano/Api/Experimental/Era.hs Updates constraints for tx body hashing type
cardano-api/src/Cardano/Api/Experimental/AnyScript.hs Simplifies annotator application
cardano-api/src/Cardano/Api/Experimental.hs Exposes additional constraints helper
cardano-api/src/Cardano/Api/Era/Internal/Eon/ShelleyToMaryEra.hs Updates HashAnnotated constraint to TopTx
cardano-api/src/Cardano/Api/Era/Internal/Eon/ShelleyToBabbageEra.hs Updates HashAnnotated constraint to TopTx
cardano-api/src/Cardano/Api/Era/Internal/Eon/ShelleyToAlonzoEra.hs Updates HashAnnotated constraint to TopTx
cardano-api/src/Cardano/Api/Era/Internal/Eon/ShelleyToAllegraEra.hs Updates HashAnnotated constraint to TopTx
cardano-api/src/Cardano/Api/Era/Internal/Eon/ShelleyEraOnly.hs Updates HashAnnotated constraint to TopTx
cardano-api/src/Cardano/Api/Era/Internal/Eon/ShelleyBasedEra.hs Updates constraints and adds ApplyTxError JSON constraint
cardano-api/src/Cardano/Api/Era/Internal/Eon/MaryEraOnwards.hs Updates HashAnnotated constraint to TopTx
cardano-api/src/Cardano/Api/Era/Internal/Eon/ConwayEraOnwards.hs Updates HashAnnotated constraint to TopTx
cardano-api/src/Cardano/Api/Era/Internal/Eon/BabbageEraOnwards.hs Updates HashAnnotated constraint to TopTx
cardano-api/src/Cardano/Api/Era/Internal/Eon/AlonzoEraOnwards.hs Enables Dijkstra support and updates constraints
cardano-api/src/Cardano/Api/Crypto/Ed25519Bip32.hs Updates DSIGN associated type names
cardano-api/src/Cardano/Api/Compatible/Tx.hs Updates compatible tx creation for TopTx
cardano-api/src/Cardano/Api/Certificate/Internal.hs Updates stake pool params + pool metadata hash handling
cardano-api/src/Cardano/Api/Block.hs Updates tx extraction from block body with lens
cardano-api/src/Cardano/Api/Address.hs Updates stake/payment credential and account address types
cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs Adapts generators to updated types and strict maybes
cardano-api/gen/Test/Gen/Cardano/Api.hs Updates Alonzo genesis generator for new cost model layout
cardano-api/cardano-api.cabal Updates dependencies and version constraints
cabal.project Updates index-state and wasm overrides
.github/workflows/haskell-wasm.yml Removes trailing whitespace line
Comments suppressed due to low confidence (13)

cardano-rpc/src/Cardano/Rpc/Server/Internal/UtxoRpc/Type.hs:1

  • minFeeCoefficient (linear fee per byte) is being populated from ppTxFeeFixedL, and minFeeConstant (fixed fee) from ppTxFeePerByteL. This swaps A/B semantics and will produce incorrect fees for API consumers. Map minFeeCoefficient from ppTxFeePerByteL and minFeeConstant from ppTxFeeFixedL (with the appropriate CoinPerByte/compact conversions).
    cardano-rpc/src/Cardano/Rpc/Server/Internal/UtxoRpc/Type.hs:1
  • The reverse conversion applies minFeeCoefficient to ppTxFeeFixedL and minFeeConstant to ppTxFeePerByteL, which is also swapped relative to typical min-fee semantics (A=per-byte, B=fixed). This breaks roundtrips and will misconfigure protocol parameters derived from RPC input. Swap the setters so minFeeCoefficient sets ppTxFeePerByteL and minFeeConstant sets ppTxFeeFixedL.
    cardano-api/src/Cardano/Api/Query/Internal/Type/QueryInMode.hs:1
  • Using error here makes the library crash at runtime when a caller issues QueryStakeSnapshot in a pre-Conway era (which is a normal user input path). Prefer returning a structured error (e.g., Left EraMismatch/UnsupportedNtcVersionError/a dedicated QueryConvenienceError) or restrict the constructor to ConwayEraOnwards at the type level so this cannot be constructed for earlier eras.
    cardano-api/src/Cardano/Api/Query/Internal/Type/QueryInMode.hs:1
  • Same issue as QueryStakeSnapshot: error turns an unsupported-era query into a process crash. Return a typed error instead, or make GetDRepDelegations only constructible under ConwayEraOnwards so unsupported eras are rejected statically.
    cardano-api/src/Cardano/Api/Internal/Orphans/Serialisation.hs:1
  • These instances will crash at runtime whenever JSON encoding touches NonEmptyMap/NonEmptySet (likely via derived instances that now include them). Implement these (e.g., encode NonEmptyMap as a normal Map via NonEmptyMap.toMap, and NonEmptySet as a list via NonEmptySet.toSet/toList), or remove the instances and provide explicit ToJSON where needed.
    cardano-api/src/Cardano/Api/Internal/Orphans/Serialisation.hs:1
  • This will crash if JSON encoding is attempted for a Dijkstra-era apply-tx error (even in tooling/logging paths). If Dijkstra is expected to be 'inactive', consider encoding a safe placeholder value (e.g., a tagged string/object with show) rather than throwing, or hide this instance behind a build flag so production builds cannot crash via JSON rendering.
    cardano-api/src/Cardano/Api/ProtocolParameters.hs:1
  • toCompactPartial is a partial conversion; if a caller supplies an out-of-range protocolUpdateTxFeePerByte, this can fail via exception/panic rather than returning a validation error. Prefer using the total conversion (toCompact) and propagating a meaningful Left from toShelleyCommonPParamsUpdate when compacting fails.
    cardano-api/src/Cardano/Api/ProtocolParameters.hs:1
  • toCompactPartial is a partial conversion; if a caller supplies an out-of-range protocolUpdateTxFeePerByte, this can fail via exception/panic rather than returning a validation error. Prefer using the total conversion (toCompact) and propagating a meaningful Left from toShelleyCommonPParamsUpdate when compacting fails.
    cardano-api/src/Cardano/Api/ProtocolParameters.hs:1
  • Same issue as the fee-per-byte conversion: toCompactPartial can fail at runtime for large values. Use the safe toCompact and return a validation error when the value cannot be represented in compact form.
    cardano-api/test/cardano-api-test/Test/Cardano/Api/Genesis.hs:1
  • This introduces nested fromJust in a test, which will fail with an unhelpful exception if defaults change. Prefer pattern matching or using maybe (fail ...) pure (or H.failMessage) so failures report what field was missing and why.
    cardano-api/src/Cardano/Api/Tx/Internal/Body/Lens.hs:1
  • The comments still describe a Maybe SlotNo representation (Nothing/Just), but the lens types were changed to StrictMaybe SlotNo (SNothing/SJust). Update the comment wording to match the new API to avoid misleading maintainers/users.
    cardano-api/src/Cardano/Api/Tx/Internal/Body/Lens.hs:1
  • The comments still describe a Maybe SlotNo representation (Nothing/Just), but the lens types were changed to StrictMaybe SlotNo (SNothing/SJust). Update the comment wording to match the new API to avoid misleading maintainers/users.
    cardano-rpc/test/cardano-rpc-test/Test/Cardano/Rpc/ProtocolParameters.hs:1
  • %~ id is a no-op and adds noise to an already dense test transformation pipeline. If no transformation is needed, consider removing these two lens updates entirely (and keep a brief comment nearby if the rationale is important).

geo2a and others added 10 commits March 17, 2026 17:43
Replace stub `toJSON = undefined` implementations with real ones
that delegate to the underlying Map and Set instances via toMap/toSet.
Handle StrictMaybe/Maybe conversion inside the lenses (via strictMaybeL)
rather than exposing StrictMaybe in the public API. Keeps TxValidityUpperBound,
convValidityLowerBound, convValidityUpperBound, and the three validity bound
lenses stable.
GetStakeSnapshots in ouroboros-consensus 1.0.0.0 requires EraGov,
which must be available in the context of toConsensusQueryShelleyBased.
@Jimbo4350 Jimbo4350 force-pushed the geo2a/10.7-integration branch from b6e7a96 to a7086b9 Compare March 17, 2026 21:44
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.

7 participants