Skip to content

Update compatible transaction building for the cardano-api changes - #1408

Open
carbolymer wants to merge 1 commit into
masterfrom
mgalazyn/feature/update-compatible-tx
Open

Update compatible transaction building for the cardano-api changes#1408
carbolymer wants to merge 1 commit into
masterfrom
mgalazyn/feature/update-compatible-tx

Conversation

@carbolymer

@carbolymer carbolymer commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Description

Adapts cardano-cli's compatible transaction building to cardano-api's new CompatibleTxBodyContent API from IntersectMBO/cardano-api#1282.
Motivated by the tx-generator migration in IntersectMBO/cardano-node#6602.

Changes:

  • runCompatibleTransactionCmd now builds the transaction by passing a single CompatibleTxBodyContent record to createCompatibleTx, starting from defaultCompatibleTxBodyContent and overriding the fields it needs (inputs, outputs, supplemental datums, fee, protocol update, voting procedures, certificates).
  • Adds a missing Bech32InvalidUtf8 case to the KES verification key Bech32 error handling in pKesVerificationKey.
  • Renames a blockNo binding to blockNumber in QueryTipLocalStateOutput's ToJSON instance to avoid shadowing.
  • Drops an unused StandardCrypto import in CreateTestnetData/Run.hs.
  • compatible transaction signed-transaction gains --protocol-params-file and --tx-in-collateral options, required to build transactions with plutus witnesses (the script integrity hash needs protocol parameters, and plutus spends need collateral).

Note

cardano-api is temporarily pinned to the head of IntersectMBO/cardano-api#1282 via a source-repository-package stanza; the pin will be dropped once that release reaches CHaP.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated
  • Self-reviewed the diff
  • Changelog fragment added in .changes/

@carbolymer carbolymer self-assigned this Aug 8, 2026
@carbolymer
carbolymer force-pushed the mgalazyn/feature/update-compatible-tx branch from bcacc88 to 4a530f9 Compare August 13, 2026 15:18
@carbolymer
carbolymer marked this pull request as ready for review August 13, 2026 15:31
@carbolymer
carbolymer requested a review from Jimbo4350 as a code owner August 13, 2026 15:31
Copilot AI lite review requested due to automatic review settings August 13, 2026 15:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates cardano-cli to align with upstream cardano-api changes, primarily around compatible transaction construction and a few related cleanups in CLI parsing and JSON output.

Changes:

  • Refactors compatible transaction creation to build from defaultCompatibleTxBodyContent and set fields explicitly.
  • Extends Bech32 KES key parsing to handle Bech32InvalidUtf8.
  • Minor naming/import adjustments in JSON output and genesis testnet data code.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
cardano-cli/src/Cardano/CLI/Type/Output.hs Renames the ChainTip block number binder for clearer JSON encoding code.
cardano-cli/src/Cardano/CLI/EraBased/Genesis/CreateTestnetData/Run.hs Adjusts ledger import list (currently breaks StandardCrypto usage later in the file).
cardano-cli/src/Cardano/CLI/EraBased/Common/Option.hs Adds handling for Bech32InvalidUtf8 in KES key parsing; exposes an error-message mismatch in the hex fallback.
cardano-cli/src/Cardano/CLI/Compatible/Transaction/Run.hs Updates compatible tx building to the newer defaultCompatibleTxBodyContent-based API shape.
Suppressed comments (1)

cardano-cli/src/Cardano/CLI/EraBased/Common/Option.hs:1962

  • The hex fallback error message says "Invalid stake pool verification key" but this parser is for a KES verification key, so the message is misleading for users.
      Left err@(Bech32InvalidUtf8 _) -> Left $ displayError err
      -- The input was not valid Bech32. Attempt to deserialise it as hex.
      Left (Bech32DecodingError _) ->
        first
          (\e -> docToString $ "Invalid stake pool verification key: " <> prettyError e)

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@carbolymer
carbolymer force-pushed the mgalazyn/feature/update-compatible-tx branch 2 times, most recently from de6d781 to 4721ced Compare August 13, 2026 15:45
@carbolymer
carbolymer force-pushed the mgalazyn/feature/update-compatible-tx branch from 4721ced to c8cb8d4 Compare August 13, 2026 16:09
@carbolymer
carbolymer force-pushed the mgalazyn/feature/update-compatible-tx branch from c8cb8d4 to 92790ca Compare August 13, 2026 17:47
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.

2 participants