@@ -814,13 +814,21 @@ async def all_subnets(
814814                method = "get_all_dynamic_info" ,
815815                block_hash = block_hash ,
816816            ),
817-             self .get_subnet_prices (),
817+             self .get_subnet_prices (block_hash = block_hash ),
818+             return_exceptions = True ,
818819        )
819820
820821        decoded  =  query .decode ()
821822
822-         for  sn  in  decoded :
823-             sn .update ({"price" : subnet_prices .get (sn ["netuid" ], Balance .from_tao (0 ))})
823+         if  not  isinstance (subnet_prices , SubstrateRequestException ):
824+             for  sn  in  decoded :
825+                 sn .update (
826+                     {"price" : subnet_prices .get (sn ["netuid" ], Balance .from_tao (0 ))}
827+                 )
828+         else :
829+             logging .warning (
830+                 f"Unable to fetch subnet prices for block { block_number } { block_hash } { subnet_prices }  
831+             )
824832        return  DynamicInfo .list_from_dicts (decoded )
825833
826834    async  def  blocks_since_last_step (
@@ -1129,21 +1137,30 @@ async def get_all_subnets_info(
11291137        Notes: 
11301138            See also: <https://docs.learnbittensor.org/glossary#subnet> 
11311139        """ 
1132-         result  =  await  self .query_runtime_api (
1133-             runtime_api = "SubnetInfoRuntimeApi" ,
1134-             method = "get_subnets_info_v2" ,
1135-             params = [],
1136-             block = block ,
1137-             block_hash = block_hash ,
1138-             reuse_block = reuse_block ,
1140+         result , prices  =  await  asyncio .gather (
1141+             self .query_runtime_api (
1142+                 runtime_api = "SubnetInfoRuntimeApi" ,
1143+                 method = "get_subnets_info_v2" ,
1144+                 params = [],
1145+                 block = block ,
1146+                 block_hash = block_hash ,
1147+                 reuse_block = reuse_block ,
1148+             ),
1149+             self .get_subnet_prices (
1150+                 block = block , block_hash = block_hash , reuse_block = reuse_block 
1151+             ),
1152+             return_exceptions = True ,
11391153        )
11401154        if  not  result :
11411155            return  []
11421156
1143-         subnets_prices  =  await  self .get_subnet_prices ()
1144- 
1145-         for  subnet  in  result :
1146-             subnet .update ({"price" : subnets_prices .get (subnet ["netuid" ], 0 )})
1157+         if  not  isinstance (prices , SubstrateRequestException ):
1158+             for  subnet  in  result :
1159+                 subnet .update ({"price" : prices .get (subnet ["netuid" ], 0 )})
1160+         else :
1161+             logging .warning (
1162+                 f"Unable to fetch subnet prices for block { block } { block_hash } { prices }  
1163+             )
11471164
11481165        return  SubnetInfo .list_from_dicts (result )
11491166
@@ -2035,6 +2052,7 @@ async def get_metagraph_info(
20352052                "SubnetInfoRuntimeApi" ,
20362053                "get_metagraph" ,
20372054                params = [netuid ],
2055+                 block_hash = block_hash ,
20382056            )
20392057
20402058        if  query .value  is  None :
0 commit comments