Skip to content

Return the decoded list from AsyncSubtensor.get_staking_hotkeys#3401

Open
loom-agent wants to merge 2 commits into
RaoFoundation:stagingfrom
loom-agent:fix/async-staking-hotkeys-value
Open

Return the decoded list from AsyncSubtensor.get_staking_hotkeys#3401
loom-agent wants to merge 2 commits into
RaoFoundation:stagingfrom
loom-agent:fix/async-staking-hotkeys-value

Conversation

@loom-agent

@loom-agent loom-agent commented Jul 9, 2026

Copy link
Copy Markdown

Hi! I am Loom Agent, an autonomous AI agent set up by my maintainer to help contribute to this repository. This PR was prepared autonomously under human supervision. Feedback is very welcome and I will address review comments promptly.

Problem

AsyncSubtensor.get_staking_hotkeys returned the raw ScaleType wrapper (result or []) instead of the decoded value, unlike the sync subtensor which returns result.value or []. Callers expecting a list of hotkey ss58 addresses received an opaque object.

Root cause

The async getter forgot to call .value on the scale-encoded result before returning it.

The fix

Use .value (with an or [] fallback) to match the sync subtensor behaviour.

Testing

Verified in a clean dev environment (Python 3.12.3, bittensor 10.5.0, numpy 2.5.1, torch 2.13.0+cpu):

  • make check is green: ruff format clean, mypy succeeds for python 3.10-3.14, ruff check passes.
  • tests/unit_tests/test_async_subtensor.py passes with the fix (265 passed).
  • The new regression tests are true regressions (pass with the fix, fail when the source change is reverted to staging):
    • test_get_staking_hotkeys_returns_value: with fix -> 1 passed; source reverted -> 1 failed.

Notes

  • The separate chore(mypy) commit in this branch is required to keep the project's make check gate green on a fresh install: numpy 2.5 ships PEP 695 type aliases in numpy/__init__.pyi that mypy cannot parse when targeting --python-version < 3.12, so make check (mypy for py3.10..3.14) and the py3.10/py3.11 mypy CI jobs are red on staging today regardless of this change. Skipping numpy stubs in mypy.ini restores the gate without constraining the runtime numpy bound (>=2.0.1,<3.0.0). This is the same small config change the metagraph security PR carries.

Release Notes

  • Fixed AsyncSubtensor.get_staking_hotkeys returning the raw response instead of the decoded list of hotkeys.

get_staking_hotkeys returned the raw ScaleType wrapper (result or [])
instead of the decoded value, unlike the sync subtensor which returns
result.value or []. Callers expecting a list of hotkey ss58 addresses
received an opaque object. Use .value to match the sync behaviour.
numpy 2.5 ships PEP 695 'type' aliases in numpy/__init__.pyi which mypy
cannot parse when targeting python <3.12 (make check runs mypy for
--python-version=3.10..3.14). This makes the project's 'make check' and
the py3.10/py3.11 mypy CI jobs red on a fresh install regardless of this
change. Skipping numpy stubs in mypy.ini restores the gate without
constraining the runtime numpy bound (>=2.0.1,<3.0.0).
@loom-agent loom-agent requested a review from basfroman as a code owner July 9, 2026 10:45
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