diff --git a/bittensor/core/async_subtensor.py b/bittensor/core/async_subtensor.py index e1f1d1b51d..d49fe2e48c 100644 --- a/bittensor/core/async_subtensor.py +++ b/bittensor/core/async_subtensor.py @@ -4903,7 +4903,7 @@ async def get_staking_hotkeys( params=[coldkey_ss58], block_hash=block_hash, ) - return result or [] + return result.value or [] async def get_start_call_delay( self, diff --git a/mypy.ini b/mypy.ini index d38bdc7172..054851282e 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1,6 +1,13 @@ [mypy] ignore_missing_imports = True ignore_errors = True +follow_imports_for_stubs = True + +[mypy-numpy.*] +follow_imports = skip + +[mypy-numpy] +follow_imports = skip [mypy-*.axon.*] ignore_errors = False diff --git a/tests/unit_tests/test_async_subtensor.py b/tests/unit_tests/test_async_subtensor.py index 94029b20ab..9532f54159 100644 --- a/tests/unit_tests/test_async_subtensor.py +++ b/tests/unit_tests/test_async_subtensor.py @@ -286,6 +286,26 @@ async def test_get_subnet_burn_cost(subtensor, mocker): ) +@pytest.mark.asyncio +async def test_get_staking_hotkeys_returns_value(subtensor, mocker): + """get_staking_hotkeys must return the decoded list (``.value``), not the raw ScaleType.""" + # Preps - mimic a ScaleType whose ``.value`` is the list of hotkey ss58 addresses + fake_hotkeys = ["5GrwvaEF...", "5FHneW46..."] + mocked_substrate_query = mocker.AsyncMock( + autospec=async_subtensor.AsyncSubstrateInterface.query, + return_value=mocker.Mock(value=fake_hotkeys), + ) + subtensor.substrate.query = mocked_substrate_query + + # Call + result = await subtensor.get_staking_hotkeys( + coldkey_ss58="5DDjk9T2...", block_hash=None + ) + + # Assert - the decoded list is returned, not the wrapper object + assert result == fake_hotkeys + + @pytest.mark.asyncio async def test_get_total_subnets(subtensor, mocker): """Tests get_total_subnets method."""