Skip to content

Cannot get correct information for Bittensor validator #2564

@antonr-p2p

Description

@antonr-p2p

Describe the bug

I try to get info about validator. Most of the fields get correct info, but not all of them.
I use get_delegate_by_hotkey method for which return_per_1000 and total_daily_return options return either 0 values or incorrect ones.

I tried to use get_delegates method as well, but it look like there is an issue with code in your library around decoded = bt_decode.DelegateInfo.decode_vec(vec_u8) in core/chain_data/delegate_info.py

So both methods either don't work or return incorrect info. Please fix or provide any other way.
Thanks in advance!

To Reproduce

WAY 1:

import bittensor as bt
sub=bt.subtensor()
v=sub.get_delegate_by_hotkey(hotkey_ss58='VAL_HOTKEY')
v.total_daily_return
## τ0.000000000
v.return_per_1000
## τ0.000000000

WAY 2:

from bittensor.core.chain_data import DelegateInfo 
import bittensor as bt

sub=bt.subtensor()
delegates: List[DelegateInfo] = sub.get_delegates()
>>>Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/anton/bt/bt_prod/lib/python3.10/site-packages/bittensor/utils/networking.py", line 198, in wrapper
    return func(self, *args, **kwargs)
  File "/home/anton/bt/bt_prod/lib/python3.10/site-packages/bittensor/core/subtensor.py", line 1670, in get_delegates
    return DelegateInfo.list_from_vec_u8(result)
  File "/home/anton/bt/bt_prod/lib/python3.10/site-packages/bittensor/core/chain_data/delegate_info.py", line 65, in list_from_vec_u8
    decoded = bt_decode.DelegateInfo.decode_vec(vec_u8)
TypeError: argument 'encoded': 'list' object cannot be converted to 'PyBytes'

Expected behavior

I get correct values for validator daily return and return per 1000 TAO.

Screenshots

No response

Environment

Bittensor python package 8.5.1

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions