feat: Add proxy list, proxy reject, and proxy remove --all#833
Open
MkDev11 wants to merge 3 commits intoopentensor:stagingfrom
Open
feat: Add proxy list, proxy reject, and proxy remove --all#833MkDev11 wants to merge 3 commits intoopentensor:stagingfrom
MkDev11 wants to merge 3 commits intoopentensor:stagingfrom
Conversation
26c1aad to
3e45257
Compare
Contributor
Author
|
@thewhaleking could you please review the PR and let me know your feedback? |
2b62ff5 to
adf8647
Compare
Contributor
thewhaleking
left a comment
There was a problem hiding this comment.
I think overall this is fine, but I need some time to do some deeper review/testing, as it's a large PR. I'll make it a point to do this next week.
603b8f2 to
348a330
Compare
Contributor
Author
thanks for your feedback 👍 |
348a330 to
45e79f2
Compare
- _parse_proxy_storage: parse Proxy.Proxies chain storage into normalized dicts, handles dict/tuple formats and nested byte-tuples via decode_account_id - list_proxies: query and display proxies with table and JSON output - remove_all_proxies: call Proxy.remove_proxies via submit_proxy - reject_announcement: call Proxy.reject_announcement with confirmation and JSON support
- Register proxy list and proxy reject commands in CLI - proxy_list: query proxies for an address or wallet coldkey - proxy_reject: reject announced call, resolve from ProxyAnnouncements DB, mark as executed on success - proxy_remove: add --all flag (mutually exclusive with --delegate), branch to remove_all_proxies vs remove_proxy - Use print_error consistently, WV.WALLET for proxy_list fallback
Unit tests (tests/unit_tests/test_cli.py): - 7 tests for _parse_proxy_storage edge cases - 4 tests for list_proxies (success, JSON, empty, error) - 3 tests for remove_all_proxies (success, prompt declined, unlock) - 4 tests for reject_announcement (success, JSON, declined, failure) - 6 CLI handler tests for proxy_remove, proxy_list, proxy_reject E2E test (tests/e2e_tests/test_proxy.py): - test_proxy_list: add proxy, list, verify delegate, cleanup
38894bb to
ca00a67
Compare
Contributor
Author
|
CI test errors are gone. please review the changes when you are available. thanks. |
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.
New commands:
btcli proxy list— Lists proxies for an account by querying chain storageProxy.Proxies. Optional--address(defaults to selected wallet). Supports--json-output.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).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; handles nested substrate response formats usingdecode_account_id.bittensor_cli/cli.py: Registeredproxy listandproxy reject; extendedproxy_removewith--allflag (mutually exclusive with--delegate);proxy_rejectintegrates with ProxyAnnouncements (resolve call_hash, mark_as_executed on success).tests/unit_tests/test_cli.py: 7 tests for_parse_proxy_storage(None, non-sequence, dict format, dict proxy_type, tuple unwrap, empty list, malformed entries, delegatee key); tests forlist_proxies(success, JSON, empty, error); tests forremove_all_proxies(success, prompt declined, unlock failure); tests forreject_announcement(success, JSON, prompt declined, failure); CLI handler tests forproxy_remove(mutual exclusivity, require delegate or all, --all vs --delegate),proxy_list(with/without address),proxy_reject.tests/e2e_tests/test_proxy.py: E2E testtest_proxy_list(add proxy, list, verify delegate in output, cleanup).Testing
pytest tests/unit_tests/test_cli.py— 55 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 "test_proxy_list".Checklist
staging(or target staging when opening the PR).