Skip to content

feat: Add proxy list, proxy reject, and proxy remove --all#833

Open
MkDev11 wants to merge 3 commits intoopentensor:stagingfrom
MkDev11:feat/proxy-additions-742-v2
Open

feat: Add proxy list, proxy reject, and proxy remove --all#833
MkDev11 wants to merge 3 commits intoopentensor:stagingfrom
MkDev11:feat/proxy-additions-742-v2

Conversation

@MkDev11
Copy link
Contributor

@MkDev11 MkDev11 commented Feb 23, 2026

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 storage Proxy.Proxies. Optional --address (defaults to selected wallet). Supports --json-output.
  • btcli proxy reject — Rejects a previously announced proxy call via Proxy.reject_announcement. Optional --delegate (defaults to wallet coldkey). Resolves --call-hash from the ProxyAnnouncements table when available and marks the announcement as executed on success (same flow as btcli proxy execute).

Modified command:

  • btcli proxy remove — Added --all flag to remove every proxy for the account in one call (Proxy.remove_proxies). --all and --delegate are 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 using decode_account_id.
  • bittensor_cli/cli.py: Registered proxy list and proxy reject; extended proxy_remove with --all flag (mutually exclusive with --delegate); proxy_reject integrates 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 for list_proxies (success, JSON, empty, error); tests for remove_all_proxies (success, prompt declined, unlock failure); tests for reject_announcement (success, JSON, prompt declined, failure); CLI handler tests for proxy_remove (mutual exclusivity, require delegate or all, --all vs --delegate), proxy_list (with/without address), proxy_reject.
  • tests/e2e_tests/test_proxy.py: E2E test test_proxy_list (add proxy, list, verify delegate in output, cleanup).

Testing

  • Unit: pytest tests/unit_tests/test_cli.py — 55 passed.
  • Lint: 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.
  • E2E (with local chain): pytest tests/e2e_tests/test_proxy.py -v -k "test_proxy_list".

Checklist

  • Code formatted with ruff; tests pass.
  • Branch off staging (or target staging when opening the PR).
  • New feature includes tests (unit + e2e).
  • PR description explains what changes do and which issue is resolved.

@thewhaleking thewhaleking requested a review from a team February 23, 2026 15:51
@MkDev11 MkDev11 changed the base branch from staging to main February 23, 2026 17:12
@MkDev11 MkDev11 changed the base branch from main to staging February 23, 2026 17:13
@MkDev11 MkDev11 force-pushed the feat/proxy-additions-742-v2 branch from 26c1aad to 3e45257 Compare February 26, 2026 12:06
@MkDev11
Copy link
Contributor Author

MkDev11 commented Feb 26, 2026

@thewhaleking could you please review the PR and let me know your feedback?

@MkDev11 MkDev11 force-pushed the feat/proxy-additions-742-v2 branch 2 times, most recently from 2b62ff5 to adf8647 Compare February 26, 2026 15:15
Copy link
Contributor

@thewhaleking thewhaleking left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@MkDev11 MkDev11 force-pushed the feat/proxy-additions-742-v2 branch from 603b8f2 to 348a330 Compare February 27, 2026 04:23
@MkDev11
Copy link
Contributor Author

MkDev11 commented Feb 27, 2026

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.

thanks for your feedback 👍

@MkDev11 MkDev11 requested a review from thewhaleking March 10, 2026 14:27
@MkDev11 MkDev11 force-pushed the feat/proxy-additions-742-v2 branch from 348a330 to 45e79f2 Compare March 18, 2026 23:55
@MkDev11 MkDev11 marked this pull request as draft March 19, 2026 00:53
MkDev11 added 3 commits March 19, 2026 02:20
- _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
@MkDev11 MkDev11 force-pushed the feat/proxy-additions-742-v2 branch from 38894bb to ca00a67 Compare March 19, 2026 01:21
@MkDev11 MkDev11 marked this pull request as ready for review March 19, 2026 01:21
@MkDev11
Copy link
Contributor Author

MkDev11 commented Mar 19, 2026

CI test errors are gone. please review the changes when you are available. thanks.

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.

2 participants