Skip to content

feat(tx): ensure commands sending txs output diagnostic events on failure (#2224) - #2841

Closed
jdjioe5-cpu wants to merge 1 commit into
stellar:mainfrom
jdjioe5-cpu:feat/issue-2224-diagnostic-events-on-failure
Closed

jdjioe5-cpu wants to merge 1 commit into
stellar:mainfrom
jdjioe5-cpu:feat/issue-2224-diagnostic-events-on-failure

Conversation

@jdjioe5-cpu

Copy link
Copy Markdown

What

Ensure commands that send or simulate transactions always output diagnostic events when there is a failure, and ensure diagnostic events are logged when using --very-verbose.

Specifically:

  • In simulate_and_assemble_transaction (cmd/soroban-cli/src/assembled.rs):
    • When sim_res.error is present (simulation failed), diagnostic failure events are rendered via crate::log::event::failure(&events, &print) in addition to being logged via crate::log::event::all(&events).
    • When simulation succeeds, crate::log::event::all(&events) logs the diagnostic events at debug level (visible under --verbose / --very-verbose).
  • In send_transaction_polling_with_events (cmd/soroban-cli/src/tx.rs):
    • When transaction submission succeeds, crate::log::event::all(&res.events.diagnostic_events) is called so that diagnostic events are logged at debug level under --verbose / --very-verbose.
  • In cmd/soroban-cli/src/log/event.rs:
    • Use unwrap_or_default() in all(&events) for serialization robustness.
    • Added unit test test_failure_outputs_error_and_log_events verifying failure and diagnostic event handling.

Why

Resolves #2224.
Previously:

  1. When a transaction failed during preflight simulation (e.g. host error, contract panic, budget exceeded), diagnostic events decoded by RPC were available on sim_res.events() but only logged at debug level and never rendered to stderr. Users only saw Error::TransactionSimulationFailed without the underlying host/contract error events or diagnostic logs.
  2. In --very-verbose mode, successful simulations and successful transaction submissions did not call crate::log::event::all, meaning diagnostic events were completely missing from the debug/trace stream.

Known limitations

None. Backward compatibility is fully preserved.

@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX Oct 22, 2026
@github-project-automation github-project-automation Bot moved this from Backlog (Not Ready) to Done in DevX Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Ensure commands sending txs always output diagnostic events when there's a failure.

2 participants