Skip to content

Commit b7ff897

Browse files
author
Roman
committed
fix review comments
1 parent bf70ddd commit b7ff897

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

bittensor/core/async_subtensor.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2620,9 +2620,7 @@ async def get_subnet_price(
26202620
if netuid == 0:
26212621
return Balance.from_tao(1)
26222622

2623-
block_hash = await self.determine_block_hash(
2624-
block=block, block_hash=block_hash, reuse_block=reuse_block
2625-
)
2623+
block_hash = await self.determine_block_hash(block=block)
26262624
current_sqrt_price = await self.substrate.query(
26272625
module="Swap",
26282626
storage_function="AlphaSqrtPrice",
@@ -3740,22 +3738,24 @@ async def subnet(
37403738
if not block_hash and reuse_block:
37413739
block_hash = self.substrate.last_block_hash
37423740

3743-
query = await self.substrate.runtime_call(
3744-
"SubnetInfoRuntimeApi",
3745-
"get_dynamic_info",
3746-
params=[netuid],
3747-
block_hash=block_hash,
3741+
query, price = await asyncio.gather(
3742+
self.substrate.runtime_call(
3743+
"SubnetInfoRuntimeApi",
3744+
"get_dynamic_info",
3745+
params=[netuid],
3746+
block_hash=block_hash,
3747+
),
3748+
self.get_subnet_price(
3749+
netuid=netuid,
3750+
block=block,
3751+
block_hash=block_hash,
3752+
reuse_block=reuse_block,
3753+
),
3754+
return_exceptions=True,
37483755
)
37493756

37503757
if isinstance(decoded := query.decode(), dict):
3751-
try:
3752-
price = await self.get_subnet_price(
3753-
netuid=netuid,
3754-
block=block,
3755-
block_hash=block_hash,
3756-
reuse_block=reuse_block,
3757-
)
3758-
except SubstrateRequestException:
3758+
if isinstance(price, SubstrateRequestException):
37593759
price = None
37603760
return DynamicInfo.from_dict({**decoded, "price": price})
37613761
return None

bittensor/core/chain_data/dynamic_info.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ def _from_dict(cls, decoded: dict) -> "DynamicInfo":
9595

9696
price = decoded.get("price", None)
9797

98-
print(f">>> price: {type(price)}, {price}")
9998
if price and not isinstance(price, Balance):
10099
raise ValueError(f"price must be a Balance object, got {type(price)}.")
101100

0 commit comments

Comments
 (0)