feat: Add proxy list, proxy reject, and proxy remove --all#833
Open
MkDev11 wants to merge 11 commits intoopentensor:stagingfrom
Open
feat: Add proxy list, proxy reject, and proxy remove --all#833MkDev11 wants to merge 11 commits intoopentensor:stagingfrom
MkDev11 wants to merge 11 commits intoopentensor:stagingfrom
Conversation
- btcli proxy list: query Proxy.Proxies storage, optional --address, --json-output - btcli proxy reject: Proxy.reject_announcement; optional --delegate; resolves call_hash from ProxyAnnouncements, marks as executed on success (proxy_reject_announced) - btcli proxy remove --all: Proxy.remove_proxies; mutually exclusive with --delegate Addresses PR opentensor#745 feedback: top-level imports, empty query handling, naming (proxy_reject_announced), ProxyAnnouncements flow for reject.
- Respect DISK_CACHE=0 in SubtensorInterface (use cache only when config and env allow) - Force use_disk_cache=False in CLI initialize_chain when DISK_CACHE=0 - Set DISK_CACHE=0 in e2e exec_command env so all e2e CLI runs skip cache Fixes coldkey_swap and proxy e2e failures from missing cache tables.
test_coldkey_swap_dispute was missing --no-mev-protection on the subnets create call, unlike test_coldkey_swap_with_stake which had it. MEV protection fails on the local chain, causing subnets create to return success: False.
…roxy entries Two issues causing proxy e2e test failures: 1. proxy_remove used Options.proxy_type which has prompt=True, causing Typer to prompt for proxy_type even with --all (before function body runs). Changed to a non-prompting typer.Option for proxy_remove. 2. _parse_proxy_storage only handled list/tuple proxy items but async_substrate_interface decodes Proxy.Proxies entries as dicts. Added dict handling and direct SS58 string passthrough.
Substrate returns proxy storage with extra nesting:
- Items wrapped in single-element tuples: (dict,) instead of dict
- Delegate as nested tuple: ((bytes...),) instead of (bytes...)
- Proxy type as dict: {'Any': ()} instead of 'Any'
Adds unwrapping logic and dict proxy_type extraction.
Contributor
Author
|
@thewhaleking could you please review the PR and let me know your feedback? |
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.
Description
Closes #742
Adds the missing proxy commands and flag from issue #742 and incorporates feedback from PR #745.
New commands:
btcli proxy list— Lists proxies for an account by querying chain storageProxy.Proxies. Optional--address(defaults to selected wallet). Supports--json-output. Handles empty query result with explicit success/failure in JSON.btcli proxy reject— Rejects a previously announced proxy call viaProxy.reject_announcement. Optional--delegate(defaults to wallet coldkey). Resolves--call-hashfrom the ProxyAnnouncements table when available and marks the announcement as executed on success (same flow asbtcli proxy execute). Implemented asproxy_reject_announcedfor naming consistency withproxy_execute_announced.Modified command:
btcli proxy remove— Added--allflag to remove every proxy for the account in one call (Proxy.remove_proxies).--alland--delegateare mutually exclusive; one is required.Changes
bittensor_cli/src/commands/proxy.py: Added_parse_proxy_storage,list_proxies,reject_announcement,remove_all_proxies; empty query handling for list; list/tuple delegate decoding for chain data.bittensor_cli/cli.py: Registeredproxy listandproxy reject(handlerproxy_reject_announced); extendedproxy_removewith--all, validation, and branching toremove_all_proxiesvsremove_proxy;proxy_reject_announcedintegrates with ProxyAnnouncements (resolve call_hash, mark_as_executed on success).tests/unit_tests/test_cli.py: Unit tests for storage parsing (empty, one row, delegate-as-list), proxy_remove (mutual exclusivity, require delegate or all, --all vs delegate), proxy_list (with/without address), proxy_reject_announced (reject_announcement call, mark_as_executed when matched from DB).tests/e2e_tests/test_proxy.py: E2E teststest_proxy_list_after_addandtest_proxy_remove_all(require local chain).Testing
pytest tests/unit_tests/test_cli.py -v -k "proxy or parse_proxy"— 26 passed.ruff check bittensor_cli/src/commands/proxy.py bittensor_cli/cli.py tests/unit_tests/test_cli.py tests/e2e_tests/test_proxy.py— all checks passed.pytest tests/e2e_tests/test_proxy.py -v -k "list_after_add or remove_all".Checklist
staging(or target staging when opening the PR).