Skip to content

Fix: burned_register supports root subnet (netuid=0 param)#2732

Merged
zyzniewski-reef merged 7 commits intostagingfrom
fix/zyzniewski/burned_register_supports_root_subnet
Mar 13, 2025
Merged

Fix: burned_register supports root subnet (netuid=0 param)#2732
zyzniewski-reef merged 7 commits intostagingfrom
fix/zyzniewski/burned_register_supports_root_subnet

Conversation

@zyzniewski-reef
Copy link
Contributor

Copy link
Contributor

@thewhaleking thewhaleking left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM, just fix the gather catch

@@ -2901,6 +2901,14 @@ async def burned_register(
bool: ``True`` if the registration is successful, False otherwise.
"""
async with self:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is unrelated to this PR, but why do we do this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably to make sure Subtensor/Substrate is properly initialized?

Comment on lines +73 to +85
try:
recycle_call, balance = await asyncio.gather(
subtensor.get_hyperparameter(
param_name="Burn",
netuid=netuid,
block_hash=block_hash,
),
subtensor.get_balance(
wallet.coldkeypub.ss58_address,
block_hash=block_hash,
),
)
except TypeError as e:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually a fairly difficult one. asyncio.gather returns errors in an odd non-standard way, where doing it like this can usually catch fine, but sometimes will not. You'll instead want to use asyncio.gather(*cos, return_exceptions=True) and then check to see if the returns are the exception type. It's not great, but it's the spec.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really understand. Can you provide an example of "non-catchable" exception thrown from asyncio.gather?

Copy link
Contributor Author

@zyzniewski-reef zyzniewski-reef Mar 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think TypeError very likely can be safely removed anyway (I've copied it from existing root_register method code) as it seems to be a leftover from this: 835dfdb#diff-87f2770377552e515f60ce0d2e31a3a9bb129bffa240ab2133e3233d3e22f6c3R1141-R1145

@zyzniewski-reef zyzniewski-reef requested a review from a team March 12, 2025 18:25
@zyzniewski-reef zyzniewski-reef merged commit 2300a52 into staging Mar 13, 2025
37 checks passed
@zyzniewski-reef zyzniewski-reef deleted the fix/zyzniewski/burned_register_supports_root_subnet branch March 13, 2025 17:24
This was referenced Mar 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants