Skip to content

fix: validate addresses in alw miner post before committing to chain#156

Closed
wdeveloper16 wants to merge 1 commit into
entrius:testfrom
wdeveloper16:fix/validate-miner-pair-addresses
Closed

fix: validate addresses in alw miner post before committing to chain#156
wdeveloper16 wants to merge 1 commit into
entrius:testfrom
wdeveloper16:fix/validate-miner-pair-addresses

Conversation

@wdeveloper16
Copy link
Copy Markdown
Contributor

Closes: #155

Summary

alw miner post accepted any string as a BTC or TAO address and committed it to the subnet without validation. A miner who typos their receiving address becomes unable to receive funds from matched swaps — their collateral is at risk and users matched to them will experience failed fulfillments.

What changed

allways/cli/swap_commands/pair.py

  • After chains and addresses are resolved (but before showing the confirmation summary), creates chain providers with check=False and calls is_valid_address() for both the source and destination address
  • Both BitcoinProvider and SubtensorProvider validate locally — no network connections are made
  • Rejects with a clear [red]Invalid <ChainName> address: <addr>[/red] message and returns early

tests/test_pair_validation.py (new, 4 tests)

  • Invalid src address rejected
  • Invalid dst address rejected
  • Valid addresses proceed to confirmation
  • Both invalid shows only the first error

Test Case

Before:

image

After:

image

@anderdc
Copy link
Copy Markdown
Collaborator

anderdc commented Apr 21, 2026

duplicate identified

@anderdc anderdc closed this Apr 21, 2026
@wdeveloper16
Copy link
Copy Markdown
Contributor Author

Hi, @anderdc
Would you please clarify the closing reason more?

@wdeveloper16
Copy link
Copy Markdown
Contributor Author

I think it's really needed before moving fulfillment

@wdeveloper16
Copy link
Copy Markdown
Contributor Author

Hi, @anderdc
Could you review the PR, please?
My logic is smart and clear than #133.

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.

alw miner post accepts invalid BTC/TAO addresses, risking stranded collateral and failed swap fulfillments

2 participants