feat: Add proxy list, proxy reject, and proxy remove --all#833
Open
MkDev11 wants to merge 2 commits intoopentensor:stagingfrom
Open
feat: Add proxy list, proxy reject, and proxy remove --all#833MkDev11 wants to merge 2 commits intoopentensor:stagingfrom
MkDev11 wants to merge 2 commits intoopentensor:stagingfrom
Conversation
26c1aad to
3e45257
Compare
Contributor
Author
|
@thewhaleking could you please review the PR and let me know your feedback? |
3e45257 to
2b62ff5
Compare
New commands: - btcli proxy list: query Proxy.Proxies storage for an account - btcli proxy reject: reject a previously announced proxy call Modified command: - btcli proxy remove --all: remove every proxy at once Implementation: - proxy.py: _parse_proxy_storage, list_proxies, reject_announcement, remove_all_proxies; handles nested substrate response formats - cli.py: register proxy list/reject; extend proxy remove with --all flag (mutually exclusive with --delegate) - Specific exception handling (KeyError/TypeError/ValueError/IndexError) with debug logging in _parse_proxy_storage Note: CI will fail on import due to a pre-existing staging bug where extract_mev_shield_id was removed from mev_shield.py but still imported by sudo.py. This is not related to this PR. Tests: - 16 unit tests for parsing, list, reject, remove --all - 2 E2E tests (test_proxy_list_after_add, test_proxy_remove_all) - 1 E2E test (test_proxy_reject_announced)
2b62ff5 to
adf8647
Compare
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).