fix: validate src/dst addresses in alw miner post before chain commit#133
Open
edwin-rivera-dev wants to merge 1 commit into
Open
fix: validate src/dst addresses in alw miner post before chain commit#133edwin-rivera-dev wants to merge 1 commit into
edwin-rivera-dev wants to merge 1 commit into
Conversation
Author
|
Hi, @LandynDev |
Author
|
🐛 Fixed |
Author
|
Hi @anderdc , |
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.
Summary
Closes #132
alw miner postacceptedsrc_addr/dst_addr(from interactive prompts or positional args) without any format validation against their declared chains. A typo or cross-chain paste posted successfully and then silently broke every subsequent swap — reserve/confirm/send paths fail individually at the validator or miner, with no local indicator to the posting miner.This change calls
provider.is_valid_address()for both addresses against their respective chains before constructing the commitment string, mirroring the pattern used atallways/cli/swap_commands/swap.py:664-670for user destination addresses.Change
allways/cli/swap_commands/pair.py: importcreate_chain_providers; afterget_cli_contextresolvessubtensor, instantiate chain providers and validatesrc_addranddst_addrviaprovider.is_valid_address. Abort with a clear error on either failure.Behavior notes
BitcoinProvider.is_valid_addressandSubtensorProvider.is_valid_addressare local (base58 / bech32 / SS58 format checks; no RPC). Validation is ~milliseconds.get_cli_contextso the existingsubtensoris reused — no extra connection.Test plan
ruff check allways/pytest tests/alw miner postwith a good BTC + TAO pair — succeeds.alw miner post btc 5FsomethingSS58Looking tao bc1q...— aborts withInvalid BTC address: 5F....alw miner post tao 5F... btc bc1qTYPO— aborts withInvalid BTC address: bc1qTYPO.