Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix get_delegates result decoding #2551

Merged
merged 3 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bittensor/core/subtensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1774,7 +1774,7 @@ def get_delegates(self, block: Optional[int] = None) -> list[DelegateInfo]:
if not (result := json_body.get("result", None)):
return []

return DelegateInfo.list_from_vec_u8(result)
return DelegateInfo.list_from_vec_u8(bytes(result))

def is_hotkey_delegate(self, hotkey_ss58: str, block: Optional[int] = None) -> bool:
"""
Expand Down
4 changes: 2 additions & 2 deletions tests/unit_tests/test_subtensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2548,7 +2548,7 @@ def test_get_delegates_success(mocker, subtensor):
fake_block = 123
fake_block_hash = "0xabc123"
fake_json_body = {
"result": "mock_encoded_delegates",
"result": b"mock_encoded_delegates",
}

# Mocks
Expand Down Expand Up @@ -2616,7 +2616,7 @@ def test_get_delegates_latest_block(mocker, subtensor):
"""Test when no block is provided (latest block)."""
# Mock data
fake_json_body = {
"result": "mock_encoded_delegates",
"result": b"mock_encoded_delegates",
}

# Mocks
Expand Down
Loading