feat: finish SealedTx cardano-api decommission (follow-up to #5271)#5272
Conversation
b530ab1 to
65a5529
Compare
80ec3ce to
dd6ae54
Compare
65a5529 to
c2ca434
Compare
dd6ae54 to
0b619dd
Compare
|
@copilot, pls review |
|
@copilot , pls review |
|
@copilot, pls review |
Here's my review of the 7 commits in this PR: Overall assessment ✅The PR is clean, well-structured, and achieves its stated goal: Commit-by-commit notes1 – docs: plan ( 2 – port metadata extraction in 3 – drop dead code in 4 – 5 – 6 – Remove
7 – Keep decoding within supported era ( Minor observations
No blocking concerns. The changes are correct, the fallback logic in
Review posted above on the earlier comment thread — please see the detailed notes there. |
paweljakubas
left a comment
There was a problem hiding this comment.
lgtm, nothing suspicious here, pretty straightforward
…5236) ## Summary Remaining call-site migration after #5270 merged. This branch is rebased directly onto current `master` and contains the commits that switch existing wallet call sites onto the ledger-native surfaces introduced by #5270. Base branch: `master`. Follow-ups: #5271, then #5272. ## What is in this PR | # | SHA | Purpose | |---|---|---| | 1 | `84bd668` | Use `constructUnsignedTxLedger` in `balanceTx` paths | | 2 | `4c8b61b` | Replace `AnyCardanoEra` with `Read.EraValue` in NetworkLayer | | 3 | `55097e6` | Build delegation and voting certificates in `balanceTx` paths | | 4 | `f5b8ed2` | Replace `StakeAddress` with wallet-owned `RewardAccount` | | 5 | `26bad3e` | Migrate `TxMetadata` end-to-end to wallet-owned types | | 6 | `d543a6b` | Adapt singleton network conversions to #5270's `sNetworkIdToLedger` helper | The foundation work previously described here landed in #5270. In particular, the wallet-owned `NetworkId`, `TxMetadata`, `SealedTx`, ledger-native transaction builders, certificate helpers, and witness helpers are now part of `master`. ## What this PR does not do - It does not delete the remaining cardano-api bridges. - It does not remove `cardano-api` from cabal files. - It does not delete `lib/cardano-api-extra/`. - It does not finish the `SealedTx` decommission; that remains split across #5271 and #5272. ## Test plan - [x] Rebased cleanly onto `origin/master` after #5270 merged (2026-04-25). - [x] `nix develop --command cabal build cardano-wallet cardano-wallet-api cardano-wallet-unit:unit --enable-benchmarks --enable-tests --minimize-conflict-set -O0 -v0` - [ ] CI green on the rebased tip. Note: `just build 'cardano-wallet cardano-wallet-unit:unit'` reaches unrelated `cardano-wallet-read` deprecation/unused warnings promoted by `-Werror` on this branch; the same target without `-Werror` passes.
18a23ac to
fdfadf0
Compare
…5271) ## Summary Progress toward removing `Cardano.Api*` from `Cardano.Wallet.Primitive.Types.Tx.SealedTx`. Moves the first set of production and test call sites off the deprecated surface. Follow-up #5272 now finishes the remaining SealedTx cleanup. Base branch: `001-drop-cardano-api` (#5236). Rebased after #5270 merged and #5236 was rebased onto `master`. ## What this PR does Eight bisect-safe commits: | # | SHA | Effect | |---|---|---| | 1 | `04d65b2` | `docs`: plan document for the decommission series | | 2 | `b4b87af` | Test helper `compareOnCBOR` -> raw `serialisedTx` bytes, avoiding a cardano-api roundtrip | | 3 | `282807d` | Submission path `_postSealedTx` -> `EraValue Read.Tx` + `consensusGenTxFromTxRecent`; deletes `unsealShelleyTx` / `UnsealException` | | 4 | `a6d0c9d` | `parsePartialTx` -> `deserializeTx :: Either DecoderError (Read.Tx era)` per era | | 5 | `f1ba908` | Delete `cardanoTxInExactEra` after the callers are gone | | 6 | `55f2bd9` | Add `sealedTxFromLedgerTx :: Read.IsEra era => Read.Tx era -> SealedTx`; migrate `sealWriteTx` off `toCardanoApiTx`/`sealedTxFromCardano'` | | 7 | `e6feabc` | Add `sealedTxWitnessCount :: SealedTx -> Int` via ledger witnesses; migrate Server.hs away from `getSealedTxWitnesses` | | 8 | `c2ca434` | Integration test `getMetadataFromTx` -> `Meta.getMetadata . Meta.getEraMetadata` on `EraValue Read.Tx` | New ledger-native surface added to `SealedTx`: - `sealedTxFromLedgerTx :: Read.IsEra era => Read.Tx era -> SealedTx` - `sealedTxWitnessCount :: SealedTx -> Int` Deleted: - `cardanoTxInExactEra` - `Cardano.Wallet.Primitive.Ledger.Shelley.unsealShelleyTx` / `UnsealException` ## What this PR does not do The deprecated SealedTx cardano-api exports are removed in #5272, not here. Out of scope: - Removing `cardano-api` from `cardano-wallet-primitive.cabal`. - Removing `lib/cardano-api-extra/`. ## Test plan - [x] Rebased cleanly onto updated #5236 after #5270 merged (2026-04-25). - [ ] CI green on the rebased tip.
Enumerates every remaining caller of the deprecated surface after #5271: production (Cardano.Wallet.hs, Server.hs), old tx builder (Shelley/Transaction.hs, partially overlaps with #5243), integration tests (Shared/Transactions.hs, addRequiredSigners in TransactionsNew) and unit tests (TransactionSpec, TransactionLedgerSpec). Organises the work into three phases: A. reachable without #5243 (4 sites) B. unit-test migration (~20 sites, two files) C. delete the bridge functions and the three Cardano.Api* imports in SealedTx.hs
…ative Mirror the TransactionsNew.hs:getMetadataFromTx port: project metadata directly from Read.Tx era via Meta.getMetadata . Meta.getEraMetadata instead of round-tripping through cardano-api. Drops the two callers of cardanoTxIdeallyNoLaterThan in this file and the Cardano.Api / ApiEra qualified imports.
The function has been an ADP-3077 TODO stub (error "...") for a long time; the commented-out cardano-api body still referenced getSealedTxBody and sealedTxFromCardanoBody, which blocks their removal. Drop the dead block and note that a future implementation should operate on Read.Tx era via reqSignerHashesTxBodyL.
The signedTx wrapping in Cardano.Wallet went through toCardanoApiTx -> inAnyCardanoEra -> sealedTxFromCardano purely to smuggle the already-ledger tx back through cardano-api. Use the existing ledger-native sealWriteTx from Transaction.Ledger instead (now exported). Drops the two cardano-api bridges inAnyCardanoEra and sealedTxFromCardano from this module. Also refresh the sealWriteTx haddock (the function has been ledger- native since the last revamp; the stale comment claimed otherwise).
Server.hs carried a local copy of sealWriteTx that re-entered cardano-api (toCardanoApiTx + sealedTxFromCardano) to wrap an already ledger-native balanceTx result. Import the ledger-native sealWriteTx from Transaction.Ledger instead; the local helper goes away. Two call sites now pass Write.recentEra explicitly. Drops the cardano-api bridges cardanoEraFromRecentEra, toCardanoApiTx and W.sealedTxFromCardano from this module's imports.
b4da418 to
eb80853
Compare
Summary
Follow-up to #5271. This PR finishes the
Cardano.Wallet.Primitive.Types.Tx.SealedTxcardano-api decommission: the primitiveSealedTxmodule no longer importsCardano.Api, and the deprecated cardano-api-facing SealedTx exports are removed.Base branch:
feat/drop-cardano-api-sealedtx(#5271).Rebased after #5270 merged, #5236 was rebased onto
master, and #5271 was rebased onto #5236.What changed
734f62480a3de4Shared/Transactionsto ledger-native8faf76eaddRequiredSignersa929e8ebuildAndSignTransactionPureto ledger-native seale2e72afsealWriteTxcardano-api bridge in Server.hs0b619ddSealedTxcardano-api surface and move remaining unit-test adapters local to testsb4da418SealedTx surface removed
Removed from
Cardano.Wallet.Primitive.Types.Tx.SealedTxand the umbrellaCardano.Wallet.Primitive.Types.Txexport list:cardanoTxIdeallyNoLaterThansealedTxFromCardanosealedTxFromCardano'sealedTxFromCardanoBodygetSealedTxBodygetSealedTxWitnessescardanoTxFromBytescardanoApiTxToReadTxsealedTxFromBytes'now takesRead.EraValue Read.Erainstead ofAnyCardanoEra, which lets the primitive module avoidCardano.Apientirely.CI fix after rerun
The first rerun of #5272 exposed a real Conway integration failure: sealed Conway transaction bytes could be decoded as Dijkstra by the new ledger-native default path, after which downstream code hit the still-incomplete Dijkstra transaction support.
This PR now keeps the public
sealedTxFromBytesdefault capped at Conway, and the transaction layer re-decodes sealed bytes with the preferred latest era supplied by the caller before signing or decoding. That preserves the old "no later than current era" behavior without restoring the cardano-api bridge.Remaining out of scope
cardano-apifromcardano-wallet-primitive.cabal; other primitive modules still import it.lib/cardano-api-extra/.Shelley/Transaction.hsmodule.Test plan
nix develop --command fourmolu --mode inplace ...on touched Haskell filesgit diff --checknix develop --command just build 'cardano-wallet-primitive cardano-wallet cardano-wallet-unit:unit'nix develop --command cabal test cardano-wallet-unit:unit -O0 -v0 --test-options '--match="TransactionSpec"'nix develop --command cabal test cardano-wallet-unit:unit -O0 -v0 --test-options '--match="SealedTx serialisation/deserialisation"'nix develop --command cabal build cardano-wallet cardano-wallet-api cardano-wallet-unit:unit --enable-tests --enable-benchmarks --minimize-conflict-set -O0 -v0rg 'Cardano\.Api|qualified Cardano.Api' lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/SealedTx.hsreturns no matches