Skip to content

smartcontract/sdk: skip preflight simulation when submitting transactions#3750

Merged
elitegreg merged 2 commits into
mainfrom
gm/no-simulation
May 22, 2026
Merged

smartcontract/sdk: skip preflight simulation when submitting transactions#3750
elitegreg merged 2 commits into
mainfrom
gm/no-simulation

Conversation

@elitegreg
Copy link
Copy Markdown
Contributor

Summary of Changes

  • Drop the explicit simulate_transaction call in DZClient::execute_transaction_inner. Previously every successful tx was simulated twice (once here, then again by send_and_confirm_transaction's default preflight); now it's submitted once.
  • Submit with RpcSendTransactionConfig { skip_preflight: true } via send_and_confirm_transaction_with_spinner_and_config, eliminating preflight entirely.
  • Preserve the existing error UX: on failure, extract the TransactionError from ClientErrorKind::TransactionError or SendTransactionPreflightFailure, fetch program logs via get_transaction_with_config, and surface them via the same SimulationError / SimulationTransactionError types so callers and CLI output are unchanged.
  • Tradeoff: failing transactions now land onchain and burn fees instead of failing for free at simulation. The get_transaction fetch is only hit on the cold path.

Diff Breakdown

Category Files Lines (+/-) Net
Core logic 1 +72 / -26 +46

Single-file refactor of the transaction submission path in the Rust SDK.

Key files (click to expand)
  • smartcontract/sdk/rs/src/client.rs — rewrites execute_transaction_inner to skip preflight and recover program logs from get_transaction on the failure path.

Testing Verification

  • cargo test -p doublezero_sdk --lib — all 147 unit tests pass.
  • cargo clippy -p doublezero_sdk -- -Dclippy::all -Dwarnings clean.
  • Failure-path behavior not exercised against a live cluster; recommend a manual run of a known-failing CLI command (e.g. duplicate-resource create) to confirm program logs still render and DoubleZeroError mapping is intact.

elitegreg added 2 commits May 22, 2026 19:40
…ions

Previously DZClient::execute_transaction_inner ran simulate_transaction
before send_and_confirm_transaction, which itself preflights by default,
so every successful tx paid for two simulations.

Submit with skip_preflight=true and recover program logs on the failure
path via get_transaction, preserving the SimulationError /
SimulationTransactionError shape for callers.
@elitegreg elitegreg marked this pull request as ready for review May 22, 2026 19:41
@elitegreg elitegreg enabled auto-merge (squash) May 22, 2026 19:41
Copy link
Copy Markdown
Contributor

@juan-malbeclabs juan-malbeclabs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@elitegreg elitegreg merged commit 8a0f813 into main May 22, 2026
33 checks passed
@elitegreg elitegreg deleted the gm/no-simulation branch May 22, 2026 20:22
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.

2 participants