Deprecate TxBody and TxBodyContent in favour of the experimental API#1200
Open
Jimbo4350 wants to merge 3 commits into
Open
Deprecate TxBody and TxBodyContent in favour of the experimental API#1200Jimbo4350 wants to merge 3 commits into
Jimbo4350 wants to merge 3 commits into
Conversation
Jimbo4350
added a commit
that referenced
this pull request
May 7, 2026
Deprecates the old-API transaction body surface (the type, its constructor, and direct producers/consumers) so users are pointed at 'Cardano.Api.Experimental'. Internal modules that still use these symbols are annotated with -Wno-deprecations to keep -Werror green; they will be migrated in a follow-up along with the setter family. Deprecations: - TxBody (data type), ShelleyTxBody (constructor) - TxBodyContent (type/constructor) - createTransactionBody, defaultTxBodyContent - getTxBody, getTxBodyContent - BalancedTxBody The existing pattern-synonym TxBody deprecation message is updated for consistency with the new messages.
f687c93 to
67ad5f7
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR deprecates the legacy transaction body API (TxBody, TxBodyContent, and related helpers) to steer users toward the experimental transaction API, while adding -Wno-deprecations to internal/test modules that still rely on the deprecated surface to keep -Werror builds clean.
Changes:
- Added
{-# DEPRECATED #-}pragmas for the legacy Tx body types/constructors and helper functions. - Added
{-# OPTIONS_GHC -Wno-deprecations #-}in internal modules and tests that still use the deprecated API. - Added a Herald changelog fragment documenting the deprecations.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| cardano-api/test/cardano-api-test/Test/Cardano/Api/TxBody.hs | Suppress deprecation warnings in tests that still exercise legacy TxBody APIs. |
| cardano-api/test/cardano-api-test/Test/Cardano/Api/Transaction/Autobalance.hs | Suppress deprecation warnings in autobalance tests still using deprecated symbols. |
| cardano-api/test/cardano-api-test/Test/Cardano/Api/Experimental.hs | Suppress deprecation warnings in experimental tests that import legacy types during transition. |
| cardano-api/src/Cardano/Api/Tx/Internal/Sign.hs | Deprecates TxBody, ShelleyTxBody, and getTxBody; suppresses internal deprecation warnings. |
| cardano-api/src/Cardano/Api/Tx/Internal/Fee.hs | Deprecates BalancedTxBody; suppresses internal deprecation warnings. |
| cardano-api/src/Cardano/Api/Tx/Internal/Convenience.hs | Suppresses deprecation warnings where legacy balancing/building helpers are still used. |
| cardano-api/src/Cardano/Api/Tx/Internal/Body.hs | Deprecates TxBodyContent, defaultTxBodyContent, createTransactionBody, getTxBodyContent, and updates the TxBody pattern synonym deprecation message. |
| cardano-api/src/Cardano/Api/Network/IPC/Internal.hs | Suppresses deprecation warnings due to importing legacy TxBody-related internals. |
| cardano-api/src/Cardano/Api/Governance/Internal/Poll.hs | Suppresses deprecation warnings due to importing legacy TxBody/metadata internals. |
| cardano-api/src/Cardano/Api/Experimental/Tx.hs | Suppresses deprecation warnings due to intentional bridging/imports from deprecated legacy internals. |
| .changes/20260507_cardano_api_deprecate_txbody_txbodycontent.yml | Adds a changelog fragment documenting the deprecations and the temporary warning suppressions. |
Comment on lines
+865
to
+866
| {-# DEPRECATED TxBodyContent "Use 'TxBodyContent' from 'Cardano.Api.Experimental' instead." #-} | ||
|
|
Comment on lines
+896
to
897
| {-# DEPRECATED defaultTxBodyContent "Use 'TxBodyContent' from 'Cardano.Api.Experimental' instead." #-} | ||
| defaultTxBodyContent |
Replace the deprecated getTxBody/getTxId chain in Cardano.Rpc.Server.Internal.UtxoRpc.Submit with a direct ledger projection: pattern-match the API Tx, then compute the TxId via Cardano.Ledger.Core.txIdTx (which is bodyTxL composed with txIdTxBody) and lift back through fromShelleyTxId.
0b7cec1 to
3b808dd
Compare
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.
Context
Deprecates the old-API transaction body surface (the type, its constructor, and direct producers/consumers) so users are pointed at
Cardano.Api.Experimental. Internal modules that still use these symbols are annotated with-Wno-deprecationsto keep-Werrorgreen; they will be migrated in a follow-up along with the setter family.Deprecations introduced:
TxBody(data type),ShelleyTxBody(constructor)TxBodyContent(type/constructor)createTransactionBody,defaultTxBodyContentgetTxBody,getTxBodyContentBalancedTxBodyThe existing pattern-synonym
TxBodydeprecation message is updated for consistency with the new messages.How to trust this PR
{-# DEPRECATED ... #-}pragmas plus-Wno-deprecationsOPTIONS_GHCin modules that still consume the deprecated surface internally (so-Werrorstays green until the follow-up migrates those callers).cabal build cardano-api -j4is clean against currentmaster.Checklist
.changes/(will add once PR number is assigned)