Bump cardano-crypto-class to include BLS support#1135
Conversation
There was a problem hiding this comment.
Pull request overview
Updates cardano-api (and cardano-rpc) to build against newer cardano-crypto-class/ledger/network packages (including BLS support), with corresponding API and test fixture adjustments across transaction, protocol parameter, genesis, and query layers.
Changes:
- Bump/realign dependency set (ledger, ouroboros-network/consensus, crypto-wrapper) across
cabal.project, cabal files, andflake.nix. - Migrate code to updated ledger/network types (e.g.,
Tx/TxBodytyped withTopTx,AccountAddressreplacingRewardAccount, new fee fields and compact coin handling). - Update generators, tests, and genesis golden inputs to match the new ledger/genesis cost-model shape.
Reviewed changes
Copilot reviewed 63 out of 63 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| flake.nix | Adjust Nix shell dependency workaround package. |
| cardano-rpc/test/cardano-rpc-test/Test/Cardano/Rpc/ProtocolParameters.hs | Update protocol-parameter roundtrip property for new fee/compact-coin types. |
| cardano-rpc/src/Cardano/Rpc/Server/Internal/UtxoRpc/Type.hs | Update ledger↔RPC protocol-parameter conversions for new PParam fields and compact coin types. |
| cardano-rpc/cardano-rpc.cabal | Add errors dependency for new conversion helpers. |
| cardano-api/test/cardano-api-test/files/input/genesis/spec.alonzo-v2-cost-model-map-175.json | Update genesis fixture shape (cost models moved under extraConfig). |
| cardano-api/test/cardano-api-test/files/input/genesis/spec.alonzo-v2-cost-model-array-175.json | Update genesis fixture shape (cost models moved under extraConfig). |
| cardano-api/test/cardano-api-test/Test/Cardano/Api/Transaction/Autobalance.hs | Update return address type to AccountAddress. |
| cardano-api/test/cardano-api-test/Test/Cardano/Api/Genesis.hs | Adjust default cost-model extraction to match new Alonzo genesis structure. |
| cardano-api/test/cardano-api-test/Test/Cardano/Api/Experimental.hs | Update experimental tests for TopTx-parameterized ledger tx/body and new cost-model constructors. |
| cardano-api/test/cardano-api-test/Test/Cardano/Api/EpochLeadership.hs | Update stake representation to non-zero compact coin form. |
| cardano-api/test/cardano-api-test/Test/Cardano/Api/Crypto.hs | Update DSIGN size APIs to renamed associated types/functions. |
| cardano-api/test/cardano-api-golden/Test/Golden/Cardano/Api/Genesis.hs | Update credential/key role types used in golden genesis example. |
| cardano-api/src/Cardano/Api/Tx/Internal/Sign.hs | Migrate Tx/TxBody to TopTx-parameterized ledger types. |
| cardano-api/src/Cardano/Api/Tx/Internal/Output.hs | Adjust tx-out conversions; leaves commented Dijkstra-era branches. |
| cardano-api/src/Cardano/Api/Tx/Internal/Fee.hs | Update Tx type and credential role kinds to new ledger roles. |
| cardano-api/src/Cardano/Api/Tx/Internal/Body/Lens.hs | Update TxBody wrapper type and validity interval lenses (StrictMaybe↔Maybe). |
| cardano-api/src/Cardano/Api/Tx/Internal/Body.hs | Migrate many ledger TxBody references to TopTx and update key-role coercions. |
| cardano-api/src/Cardano/Api/Query/Internal/Type/QueryInMode.hs | Update peer-snapshot query plumbing and decoding helpers for new network APIs/types. |
| cardano-api/src/Cardano/Api/Query/Internal/Expr.hs | Update query signatures/types for peer snapshots and stake pool key roles. |
| cardano-api/src/Cardano/Api/Query.hs | Re-export renamed peer-snapshot decoder. |
| cardano-api/src/Cardano/Api/ProtocolParameters.hs | Update protocol-parameter update types and conversions for new fee/cost-per-byte representations; add CBOR instances. |
| cardano-api/src/Cardano/Api/Plutus/Internal/Script.hs | Simplify constraints/types for Allegra timelock conversion. |
| cardano-api/src/Cardano/Api/Network/IPC/Internal/Version.hs | Switch NodeToClientVersion import to new Cardano.Network module. |
| cardano-api/src/Cardano/Api/Network/IPC/Internal/ChainSync/Client.hs | Switch node-to-client import to Cardano.Network.NodeToClient. |
| cardano-api/src/Cardano/Api/Network/IPC/Internal.hs | Switch node-to-client protocol imports to Cardano.Network.NodeToClient. |
| cardano-api/src/Cardano/Api/LedgerState/Internal/Rule/BBODY/UTXOW.hs | Update UTXO/UTXOS event pattern matching to new event shapes. |
| cardano-api/src/Cardano/Api/LedgerState/Internal/LedgerEvent.hs | Update credential role kind usage and pool map conversion types. |
| cardano-api/src/Cardano/Api/LedgerState.hs | Update credential role kind usage and ledger tables tx-in key conversion. |
| cardano-api/src/Cardano/Api/Ledger/Internal/Reexport.hs | Update reexports for renamed ledger types and new account address exports. |
| cardano-api/src/Cardano/Api/Key/Internal/Class.hs | Switch RNG API to uniformByteString. |
| cardano-api/src/Cardano/Api/Key/Internal.hs | Update Genesis key role types to GenesisRole. |
| cardano-api/src/Cardano/Api/Internal/Orphans/Serialisation.hs | Adjust/extend JSON instances for updated ledger query types and new containers. |
| cardano-api/src/Cardano/Api/Internal/Orphans/Misc.hs | Update Semigroup merging for renamed fee fields in ledger PParams wrappers. |
| cardano-api/src/Cardano/Api/Governance/Internal/Action/ProposalProcedure.hs | Update proposal/withdrawal return-address handling to AccountAddress. |
| cardano-api/src/Cardano/Api/Genesis/Internal.hs | Update default genesis construction for new Alonzo genesis cost-model fields and fee-per-byte representation. |
| cardano-api/src/Cardano/Api/Experimental/Tx/Internal/Type.hs | Update experimental unsigned tx to TopTx-parameterized ledger Tx. |
| cardano-api/src/Cardano/Api/Experimental/Tx/Internal/Fee.hs | Update experimental fee evaluation to TopTx-parameterized ledger Tx and new credential roles. |
| cardano-api/src/Cardano/Api/Experimental/Tx/Internal/Certificate/Compatible.hs | Update pool registration certificate to StakePoolParams. |
| cardano-api/src/Cardano/Api/Experimental/Tx/Internal/Certificate.hs | Update pool metadata hashing and pool param accessors for new ledger types. |
| cardano-api/src/Cardano/Api/Experimental/Tx/Internal/BodyContent/New.hs | Adjust validity bounds handling (StrictMaybe) and key-role coercions; migrate TxBody to TopTx. |
| cardano-api/src/Cardano/Api/Experimental/Tx.hs | Update experimental signed tx and tx-body hashing types for TopTx. |
| cardano-api/src/Cardano/Api/Experimental/Simple/Script.hs | Minor simplification of deserialisation pipeline. |
| cardano-api/src/Cardano/Api/Experimental/Era.hs | Update common constraints around HashAnnotated for TopTx tx bodies. |
| cardano-api/src/Cardano/Api/Era/Internal/Eon/ShelleyToMaryEra.hs | Update HashAnnotated constraint for TopTx tx bodies. |
| cardano-api/src/Cardano/Api/Era/Internal/Eon/ShelleyToBabbageEra.hs | Update HashAnnotated constraint for TopTx tx bodies. |
| cardano-api/src/Cardano/Api/Era/Internal/Eon/ShelleyToAlonzoEra.hs | Update HashAnnotated constraint for TopTx tx bodies. |
| cardano-api/src/Cardano/Api/Era/Internal/Eon/ShelleyToAllegraEra.hs | Update HashAnnotated constraint for TopTx tx bodies. |
| cardano-api/src/Cardano/Api/Era/Internal/Eon/ShelleyEraOnly.hs | Update HashAnnotated constraint for TopTx tx bodies. |
| cardano-api/src/Cardano/Api/Era/Internal/Eon/ShelleyBasedEra.hs | Extend constraints for new governance/error JSON requirements and TopTx tx bodies. |
| cardano-api/src/Cardano/Api/Era/Internal/Eon/MaryEraOnwards.hs | Update HashAnnotated constraint for TopTx tx bodies. |
| cardano-api/src/Cardano/Api/Era/Internal/Eon/ConwayEraOnwards.hs | Update HashAnnotated constraint for TopTx tx bodies. |
| cardano-api/src/Cardano/Api/Era/Internal/Eon/BabbageEraOnwards.hs | Update HashAnnotated constraint for TopTx tx bodies. |
| cardano-api/src/Cardano/Api/Era/Internal/Eon/AlonzoEraOnwards.hs | Update HashAnnotated constraint for TopTx tx bodies; remove timelock equality constraint. |
| cardano-api/src/Cardano/Api/Era/Internal/Eon/AllegraEraOnwards.hs | Update HashAnnotated constraint for TopTx tx bodies. |
| cardano-api/src/Cardano/Api/Crypto/Ed25519Bip32.hs | Update DSIGN associated type family names for key/sig sizes. |
| cardano-api/src/Cardano/Api/Compatible/Tx.hs | Update compatible-tx building to TopTx-parameterized ledger types. |
| cardano-api/src/Cardano/Api/Certificate/Internal.hs | Update stake pool params type and pool metadata hash conversions for new ledger representation. |
| cardano-api/src/Cardano/Api/Block.hs | Update tx sequence extraction API for block bodies. |
| cardano-api/src/Cardano/Api/Address.hs | Update credential kinds and stake address serialisation to AccountAddress. |
| cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs | Update generators for fee-per-byte and compact coin representation; add Word64 generator. |
| cardano-api/gen/Test/Gen/Cardano/Api.hs | Update Alonzo genesis generator for new cost-model fields and extra config. |
| cardano-api/cardano-api.cabal | Bump dependencies and switch to new sublibrary dependencies (ouroboros, diffusion, crypto testlibs, mempack). |
| cabal.project | Add/refresh SRP stanzas for updated ledger/network/consensus dependencies and allow-newer workaround. |
You can also share your feedback on Copilot code review. Take the survey.
| decodeLedgerPeerSnapshot | ||
| :: Serialised Network.LedgerPeerSnapshot | ||
| -> Either (LBS.ByteString, DecoderError) Network.SomeLedgerPeerSnapshot |
| & U5c.coinsPerUtxoByte | ||
| .~ pparams ^. L.ppCoinsPerUTxOByteL . to L.unCoinPerByte . to L.fromCompact . to inject | ||
| & U5c.maxTxSize .~ pparams ^. L.ppMaxTxSizeL . to fromIntegral | ||
| & U5c.minFeeCoefficient .~ pparams ^. L.ppMinFeeBL . to inject | ||
| & U5c.minFeeConstant .~ pparams ^. L.ppMinFeeAL . to inject | ||
| & U5c.minFeeCoefficient .~ pparams ^. L.ppTxFeeFixedL . to inject | ||
| & U5c.minFeeConstant | ||
| .~ pparams ^. L.ppTxFeePerByteL . to L.unCoinPerByte . to L.fromCompact . to inject |
There was a problem hiding this comment.
Replacements match the deprecation warnings here:
https://github.com/IntersectMBO/cardano-ledger/blob/36b96f6e4c5259101848c3f236c0b14c0d6ec8e7/libs/cardano-ledger-core/src/Cardano/Ledger/Core/PParams.hs#L492
ppMinFeeAL "In favor of `ppTxFeePerByteL`"
ppMinFeeBL "In favor of `ppTxFeeFixedL`"
But it does look like the values are swapped. @carbolymer, could you confirm if this should be swapped?
I think copilot is right because apparently the formula is:
𝐹𝑒𝑒 = (minFeeA × txSize) + minFeeB
So minFeeB is the constant and minFeeA is the coefficient
|
This is part of work towards addressing: input-output-hk/ouroboros-leios#776 |
API breaking changes: - Regarding ChainAccountState type: * Removed AccountState type synonym * Renamed accessor fields `asTreasury` and `asReserves` to `casTreasury` and `casReserves` respectively. - Renamed PoolParams to StakePoolParams - Renamed RewardAccount to AccountAddress - Removed hashAnchorData
Breaking: - Replace `decodeBigLedgerPeerSnapshot` with `decodeLedgerPeerSnapshot`
Breaking `decodeLedgerPeerSnapshot` -> `decodeSomeLedgerPeerSnapshot`
Changelog
Context
This PR modifies API to use the latest
cardano-crypto-classwhile updating other dependencies as necessary.How to trust this PR
Do not trust, check with magnifying glass. But it should pretty much be a refactoring.
Checklist