Context
During debugging of E2E script transaction submission (cardano-foundation/cardano-mpfs-onchain#37), we wrote a diagnoseTxBody function that dumps tx body fields and CBOR hex to stderr. It was instrumental in diagnosing collateral, fee, and conservation issues.
Current implementation
In cardano-mpfs-onchain/e2e-test/CageTxBuilder.hs:
diagnoseTxBody :: String -> Tx ConwayEra -> IO ()
diagnoseTxBody label tx = do
let body = tx ^. bodyTxL
collateral = body ^. collateralInputsTxBodyL
inputs = body ^. inputsTxBodyL
fee = body ^. feeTxBodyL
mintVal = body ^. mintTxBodyL
bodyBytes = BSL.toStrict
$ serialize (eraProtVerLow @ConwayEra) body
hexStr = bytesToHex bodyBytes
hPutStrLn stderr $ "DIAG [" <> label <> "] inputs=" <> ...
Proposal
Add to Cardano.Node.Client.Balance or a new Cardano.Node.Client.Diagnostics module:
diagnoseTxBody :: String -> Tx ConwayEra -> IO () — dump body fields + CBOR hex to stderr
- Gate behind an env var (
CARDANO_TX_DIAG=1) or accept a Bool flag
- Optionally decode CBOR map keys to report which fields are present (especially key 13 = collateral)
Useful for anyone debugging tx construction, submission failures, or script evaluation issues.
Context
During debugging of E2E script transaction submission (cardano-foundation/cardano-mpfs-onchain#37), we wrote a
diagnoseTxBodyfunction that dumps tx body fields and CBOR hex to stderr. It was instrumental in diagnosing collateral, fee, and conservation issues.Current implementation
In
cardano-mpfs-onchain/e2e-test/CageTxBuilder.hs:Proposal
Add to
Cardano.Node.Client.Balanceor a newCardano.Node.Client.Diagnosticsmodule:diagnoseTxBody :: String -> Tx ConwayEra -> IO ()— dump body fields + CBOR hex to stderrCARDANO_TX_DIAG=1) or accept aBoolflagUseful for anyone debugging tx construction, submission failures, or script evaluation issues.