bittensor icon indicating copy to clipboard operation
bittensor copied to clipboard

Subtensor.get_subnets excludes subnets past netuid=100

Open camfairchild opened this issue 1 year ago • 1 comments

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.

camfairchild avatar Aug 07 '24 15:08 camfairchild