Show diagnostic events when a transaction fails on-chain - #2700
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Surfaces Soroban diagnostic events when on-chain transaction submission fails.
Changes:
- Adds shared failure-event recovery after polling.
- Formats error, contract, and log diagnostics.
- Applies behavior to invoke, send, and transaction operation commands.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
cmd/soroban-cli/src/tx.rs |
Adds shared submission and event recovery. |
cmd/soroban-cli/src/log/event.rs |
Formats failed transaction diagnostics. |
cmd/soroban-cli/src/commands/tx/send.rs |
Uses enhanced submission for tx send. |
cmd/soroban-cli/src/commands/tx/args.rs |
Uses enhanced submission for transaction operations. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
What
When a transaction passes simulation but fails on-chain, the CLI now prints the transaction's diagnostic events (host/contract error, message, and any logs) on stderr, across
contract invoke,tx send, and thetxop commands. Previously only theTransactionResultresult codes were shown. Closes #495.Why
The reason for a failure was never displayed — the diagnostic events were decoded and available on the RPC response but discarded before reaching the user.
Before (
main):After (this branch):
The new
Error eventline surfaces the host's message (operation instructions exceeds amount specified, needs3880vs1allowed) — absent before.Known limitations
Only Soroban transactions have diagnostic events; classic ops print nothing extra. The event line uses raw
ScValJSON rather than fully decoded text.