Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give user their UID immediately after root/sn registration. #108

Merged
merged 2 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion bittensor_cli/src/bittensor/extrinsics/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,6 @@ async def is_hotkey_registered(
params=[netuid, hotkey_ss58],
)
if _result is not None:
print(_result)
return True
else:
return False
Expand Down
13 changes: 9 additions & 4 deletions bittensor_cli/src/bittensor/extrinsics/root.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,17 +340,22 @@ async def root_register_extrinsic(

# Successful registration, final check for neuron and pubkey
else:
is_registered = await is_hotkey_registered(
subtensor, netuid=0, hotkey_ss58=wallet.hotkey.ss58_address
uid = await subtensor.substrate.query(
module="SubtensorModule",
storage_function="Uids",
params=[0, wallet.hotkey.ss58_address],
)
if is_registered:
console.print(":white_heavy_check_mark: [green]Registered[/green]")
if uid is not None:
console.print(
f":white_heavy_check_mark: [green]Registered with UID {uid}[/green]"
)
return True
else:
# neuron not found, try again
err_console.print(
":cross_mark: [red]Unknown error. Neuron not found.[/red]"
)
return False


async def set_root_weights_extrinsic(
Expand Down
9 changes: 7 additions & 2 deletions bittensor_cli/src/commands/root.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ async def burned_register_extrinsic(
else:
with console.status(":satellite: Checking Balance...", spinner="aesthetic"):
block_hash = await subtensor.substrate.get_chain_head()
new_balance, netuids_for_hotkey = await asyncio.gather(
new_balance, netuids_for_hotkey, my_uid = await asyncio.gather(
subtensor.get_balance(
wallet.coldkeypub.ss58_address,
block_hash=block_hash,
Expand All @@ -341,6 +341,9 @@ async def burned_register_extrinsic(
subtensor.get_netuids_for_hotkey(
wallet.hotkey.ss58_address, block_hash=block_hash
),
subtensor.substrate.query(
"SubtensorModule", "Uids", [netuid, wallet.hotkey.ss58_address]
),
)

console.print(
Expand All @@ -349,7 +352,9 @@ async def burned_register_extrinsic(
)

if len(netuids_for_hotkey) > 0:
console.print(":white_heavy_check_mark: [green]Registered[/green]")
console.print(
f":white_heavy_check_mark: [green]Registered on netuid {netuid} with UID {my_uid}[/green]"
)
return True
else:
# neuron not found, try again
Expand Down
Loading