Skip to content

Implement transaction validate command#1386

Draft
palas wants to merge 4 commits into
masterfrom
tx-validation
Draft

Implement transaction validate command#1386
palas wants to merge 4 commits into
masterfrom
tx-validation

Conversation

@palas
Copy link
Copy Markdown
Contributor

@palas palas commented May 27, 2026

Changelog

- description: |
    Add `transaction validate` command that validates a signed transaction against
    the node's current ledger state via the LocalStateQuery protocol, reporting
    both phase-1 (ledger rule) and phase-2 (Plutus script) errors with
    human-readable rendering.
  type:
    - feature

Context

Implements the transaction validate CLI command, which validates a signed transaction file against a running node's ledger state.

Part of IntersectMBO/cardano-cli#1380.

Big picture: transaction validate currently applies applyTx client-side with an empty UTxO set, making it unable to properly validate transactions. This cross-repo change adds a new ValidateTx query to the LocalStateQuery protocol so the node validates transactions against its real ledger state and UTxO set.

transaction validate PR list:

What this PR does

  • Adds transaction validate subcommand under the Conway and Latest era parsers, accepting --node-socket-path, --testnet-magic/--mainnet, and --tx-file
  • Implements runTransactionValidateCmd which deserialises the tx file, connects to the node, calls validateTx from cardano-api, and renders the results
  • Adds a comprehensive human-readable error renderer (renderApplyTxErrors in Cardano.CLI.EraBased.Transaction.Internal.ErrorRendering) that renders Conway ledger predicate failures including: UTxO validation errors (fee too low, value not conserved, missing inputs, max tx size exceeded), witness errors (missing VKey/script witnesses, native script failures), certificate errors (delegation, DRep, pool), governance errors, and Plutus script failures with script hashes and redeemer details
  • Updates golden help files for conway transaction and latest transaction

How to trust this PR

Integration tests in cardano-testnet (in the cardano-node PR) exercise the full round-trip: valid simple txs, valid Plutus txs, fee-too-low, value-not-conserved, missing witnesses, missing script witnesses, no collateral, max-tx-size exceeded, phase-2 failures, and multi-error scenarios — each with golden file comparison.

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

Closes #1380

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.

Add transaction validate command (online phase 1 + phase 2)

1 participant