CLI: --send verifies source-address control before the bid - #716
Merged
Conversation
`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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
alw swap now --sendonly discovers that the configured wallet cannot sign for the pinned--from-addressinside_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-txpath 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
--sendis explicit and the source is not the Solana signer itself, build the source provider and checkcan_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--sendto take the manual flow deliberately) and an explicit "no bid was placed, no fee was spent."The wizard's post-finalize
can_send_fromcheck 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_biddrives the CliRunner path with a provider whosecan_send_fromis false and asserts the abort happens beforeopen_or_request(the money-touching call) and beforeget_config. Fulltest_swap_now_reservation.py+test_swap_now_send_ordering.py: 39 passed.https://claude.ai/code/session_01GxaF4CWkNHSDCb6fCmh4Ki