@@ -1573,6 +1573,22 @@ async def get_metagraph_info(
1573
1573
field_indices=[SelectiveMetagraphIndex.Name, SelectiveMetagraphIndex.OwnerHotkeys]
1574
1574
)
1575
1575
"""
1576
+ block_hash = await self .determine_block_hash (block , block_hash , reuse_block )
1577
+ if not block_hash and reuse_block :
1578
+ block_hash = self .substrate .last_block_hash
1579
+
1580
+ if field_indices is None :
1581
+ query = await self .substrate .runtime_call (
1582
+ "SubnetInfoRuntimeApi" ,
1583
+ "get_metagraph" ,
1584
+ params = [netuid ],
1585
+ block_hash = block_hash ,
1586
+ )
1587
+ if query .value is None :
1588
+ logging .error (f"Subnet { netuid } does not exist." )
1589
+ return None
1590
+ return MetagraphInfo .from_dict (query .value )
1591
+
1576
1592
indexes = SelectiveMetagraphIndex .all_indices ()
1577
1593
1578
1594
if field_indices :
@@ -1588,10 +1604,6 @@ async def get_metagraph_info(
1588
1604
"`field_indices` must be a list of SelectiveMetagraphIndex items."
1589
1605
)
1590
1606
1591
- block_hash = await self .determine_block_hash (block , block_hash , reuse_block )
1592
- if not block_hash and reuse_block :
1593
- block_hash = self .substrate .last_block_hash
1594
-
1595
1607
query = await self .substrate .runtime_call (
1596
1608
"SubnetInfoRuntimeApi" ,
1597
1609
"get_selective_metagraph" ,
@@ -1601,7 +1613,13 @@ async def get_metagraph_info(
1601
1613
if query .value is None :
1602
1614
logging .error (f"Subnet { netuid } does not exist." )
1603
1615
return None
1604
- return MetagraphInfo .from_dict (query .value )
1616
+ meta : MetagraphInfo = MetagraphInfo .from_dict (query .value )
1617
+ # TODO: remove this after SelectiveMetagraph is updated in mainnet.
1618
+ if meta .netuid == 0 and meta .name != "root" :
1619
+ logging .warning (
1620
+ "Do not use the 'field_indices' argument while you see this message. Mainnet update pending."
1621
+ )
1622
+ return meta
1605
1623
1606
1624
async def get_all_metagraphs_info (
1607
1625
self ,
0 commit comments