Skip to content

CLI: --send verifies source-address control before the bid - #716

Merged
anderdc merged 1 commit into
testfrom
fix/send-precheck-source-control
Sep 2, 2026
Merged

CLI: --send verifies source-address control before the bid#716
anderdc merged 1 commit into
testfrom
fix/send-precheck-source-control

Conversation

@anderdc

@anderdc anderdc commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Problem

alw swap now --send only discovers that the configured wallet cannot sign for the pinned --from-address inside _auto_send_wizard — after the bid, draw, and finalize. By then the reservation fee is spent and the taker is dropped onto the manual send + post-tx path with the 480s TTL running and real money committed.

Hit live 2026-09-02 on a tao-source swap: config wallet: miner (whose TAO coldkey isn't on the box), vali coldkey passed as --from-address. The CLI's check was correct — but it fired at the worst possible moment. The deposit was saved by hand with ~6 minutes to spare (btcli transfer + extrinsic-hash spelunking + post-tx).

Fix

When --send is explicit and the source is not the Solana signer itself, build the source provider and check can_send_from(--from-address) before any fee is spent. On failure, abort with the remedies spelled out (fix --from-address / the configured wallet or creds, or re-run without --send to take the manual flow deliberately) and an explicit "no bid was placed, no fee was spent."

The wizard's post-finalize can_send_from check stays as defense in depth for the interactive default path (no explicit --send), whose manual fallback remains a legitimate flow (e.g. sending from an exchange).

Test

test_send_with_uncontrolled_source_aborts_before_any_bid drives the CliRunner path with a provider whose can_send_from is false and asserts the abort happens before open_or_request (the money-touching call) and before get_config. Full test_swap_now_reservation.py + test_swap_now_send_ordering.py: 39 passed.

https://claude.ai/code/session_01GxaF4CWkNHSDCb6fCmh4Ki

`alw swap now --send` promised an in-process deposit but only checked
whether the configured wallet can sign for the pinned --from-address
inside _auto_send_wizard — after the bid, the draw, and finalize. A
mismatch (config wallet vs a different source address) therefore cost
the reservation fee and dumped the taker onto the manual send+post-tx
path with a live deadline and real money committed. Hit live on a tao
source 2026-09-02: config wallet 'miner' (coldkey not on the box), vali
coldkey passed as --from-address; the deposit survived with ~6 minutes
to spare.

Now, when --send is explicit and the source is not the Solana signer
itself, the source provider is built and can_send_from(--from-address)
is checked before any fee is spent; failure aborts with the fix spelled
out (change --from-address / the configured wallet, or drop --send to
take the manual flow deliberately). The wizard's post-finalize check
stays as defense in depth for the interactive default path.

Regression test drives the CliRunner path and asserts the abort happens
before open_or_request (the money-touching call) and before get_config.

Claude-Session: https://claude.ai/code/session_01GxaF4CWkNHSDCb6fCmh4Ki
@anderdc
anderdc merged commit 1136fce into test Sep 2, 2026
3 checks passed
@anderdc
anderdc deleted the fix/send-precheck-source-control branch September 2, 2026 22:52
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.

1 participant