Skip to content

Show diagnostic events when a transaction fails on-chain - #2700

Merged
fnando merged 3 commits into
mainfrom
detailed-transaction-submission-errors
Aug 26, 2026
Merged

Show diagnostic events when a transaction fails on-chain#2700
fnando merged 3 commits into
mainfrom
detailed-transaction-submission-errors

Conversation

@fnando

@fnando fnando commented Aug 24, 2026

Copy link
Copy Markdown
Member

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 the tx op commands. Previously only the TransactionResult result 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):

🌎 Sending transaction…
❌ error: transaction submission failed: Some(
    TransactionResult {
        fee_charged: 10858,
        result: TxFailed(
            VecM([OpInner(InvokeHostFunction(ResourceLimitExceeded))]),
        ),
        ext: V0,
    },
)

After (this branch):

🌎 Sending transaction…
❌ Error event: [{"symbol":"error"},{"error":{"budget":"exceeded_limit"}}] = {"vec":[{"string":"operation instructions exceeds amount specified"},{"u64":"3880"},{"u64":"1"}]}
❌ error: transaction submission failed: Some(
    TransactionResult { ... InvokeHostFunction(ResourceLimitExceeded) ... },
)

The new Error event line surfaces the host's message (operation instructions exceeds amount specified, needs 3880 vs 1 allowed) — absent before.

Known limitations

Only Soroban transactions have diagnostic events; classic ops print nothing extra. The event line uses raw ScVal JSON rather than fully decoded text.

Copilot AI balanced review requested due to automatic review settings August 24, 2026 15:03
@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX Aug 24, 2026

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

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.