bittensor
bittensor copied to clipboard
Subtensor.get_subnets excludes subnets past netuid=100
Describe the bug
The subtensor.get_subnets function returns at most 100 subnets, regardless of the true subnet count.
To Reproduce
import bittensor
sub = bittensor.subtensor("wss://test.chain.opentensor.ai:443")
subnets = sub.get_subnets()
n_subnets = sub.get_total_subnets()
len(subnets) == n_subnets
# False
Expected behavior
import bittensor
sub = bittensor.subtensor("wss://test.chain.opentensor.ai:443")
subnets = sub.get_subnets()
n_subnets = sub.get_total_subnets()
len(subnets) == n_subnets
# True
Screenshots
No response
Environment
Bittensor 7.3.0
Additional context
This seems to happen because the function uses the subtensor.query_map_subtensor("NetworksAdded", block) which only pulls map entries a page at a time, with the default page size of 100.
We should expect it to pull all pages for this function.
This potentially affects other functions that use the maps in the same way.