Skip to content

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

Open
MkDev11 wants to merge 2 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 2 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 and incorporates feedback from PR #745.

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. Handles empty query result with explicit success/failure in JSON.
  • 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). Implemented as proxy_reject_announced for naming consistency with proxy_execute_announced.

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; empty query handling for list; list/tuple delegate decoding for chain data.
  • bittensor_cli/cli.py: Registered proxy list and proxy reject (handler proxy_reject_announced); extended proxy_remove with --all, validation, and branching to remove_all_proxies vs remove_proxy; proxy_reject_announced integrates 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 tests test_proxy_list_after_add and test_proxy_remove_all (require local chain).

Testing

  • Unit: pytest tests/unit_tests/test_cli.py -v -k "proxy or parse_proxy" — 26 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 "list_after_add or remove_all".

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 from 3e45257 to 2b62ff5 Compare February 26, 2026 13:57
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)
@MkDev11 MkDev11 force-pushed the feat/proxy-additions-742-v2 branch from 2b62ff5 to adf8647 Compare February 26, 2026 15:15
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.

1 participant