bittensor icon indicating copy to clipboard operation
bittensor copied to clipboard

Neuron Has Validator Permit Bug

Open camfairchild opened this issue 1 year ago • 0 comments

Describe the bug

The function

subtensor.neuron_has_validator_permit(netuid, uid)

Does not currently work. The storage was changed to a single map returning a UID-indexed vector of booleans matching whether the neuron has a validator permit. The client code in Bittensor was not updated to match.

To Reproduce

import bittensor
sub = bittensor.subtensor()
sub.neuron_has_validator_permit(netuid, uid)

This code raises an exception.

Expected behavior

This should return True or False depending on the netuid and UID passed.

Screenshots

No response

Environment

Bittensor 7.3.1

Additional context

_result = self.query_subtensor("ValidatorPermit", block, [netuid])
if _result is None or uid > len(_result):
    return None

return _result[uid].value

Code like this should return the correct value

camfairchild avatar Aug 19 '24 19:08 camfairchild