Skip to content

Commit 8aead8b

Browse files
committed
Merge remote-tracking branch 'origin/staging' into feat/crownload-enhancements
2 parents 1b13047 + 2673cde commit 8aead8b

31 files changed

+1224
-539
lines changed

CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,35 @@
11
# Changelog
22

3+
## 9.17.0 /2025-12-22
4+
5+
## What's Changed
6+
* feat: add cli for axon set and reset by @Mobile-Crest in https://github.com/opentensor/btcli/pull/726
7+
* json console and tests by @thewhaleking in https://github.com/opentensor/btcli/pull/744
8+
* Consolidates the `--coldkey-ss58` param into a predefined Option. by @thewhaleking in https://github.com/opentensor/btcli/pull/750
9+
* Testing: Disables non fast blocks for hyperparam by @ibraheem-abe in https://github.com/opentensor/btcli/pull/755
10+
* Feat: Improve Subnet Hyperparameters cmd #607 by @SmartDever02 in https://github.com/opentensor/btcli/pull/746
11+
* feat: show weights difference when setting root weights by @MkDev11 in https://github.com/opentensor/btcli/pull/747
12+
* Feat/Add `--no` flag to auto-decline confirmation prompts 194 by @MkDev11 in https://github.com/opentensor/btcli/pull/748
13+
* Improve subnets register command and error message by @Mobile-Crest in https://github.com/opentensor/btcli/pull/754
14+
* fix: resolve SQL syntax error in ProxyAnnouncements and improve event loop by @leonace924 in https://github.com/opentensor/btcli/pull/769
15+
* pr fixes by @thewhaleking in https://github.com/opentensor/btcli/pull/768
16+
* Account for 0x-prepended call hashes by @thewhaleking in https://github.com/opentensor/btcli/pull/772
17+
* Unit test fixes by @thewhaleking in https://github.com/opentensor/btcli/pull/775
18+
* fix: remove unused --hotkey option from wallet inspect command by @calm329 in https://github.com/opentensor/btcli/pull/770
19+
* Fix: update the err_console.print to print_error to make consistency in error printing with cross mark by @leonace924 in https://github.com/opentensor/btcli/pull/778
20+
* Feat: Safe staking in swap_stake by @ibraheem-abe in https://github.com/opentensor/btcli/pull/779
21+
* proxy execute improvements by @thewhaleking in https://github.com/opentensor/btcli/pull/774
22+
* Adds CONTRIBUTING guide by @thewhaleking in https://github.com/opentensor/btcli/pull/777
23+
24+
## New Contributors
25+
* @Mobile-Crest made their first contribution in https://github.com/opentensor/btcli/pull/726
26+
* @SmartDever02 made their first contribution in https://github.com/opentensor/btcli/pull/746
27+
* @MkDev11 made their first contribution in https://github.com/opentensor/btcli/pull/747
28+
* @leonace924 made their first contribution in https://github.com/opentensor/btcli/pull/769
29+
* @calm329 made their first contribution in https://github.com/opentensor/btcli/pull/770
30+
31+
**Full Changelog**: https://github.com/opentensor/btcli/compare/v9.16.0...v9.17.0
32+
333
## 9.16.0 /2025-12-09
434

535
## What's Changed

CONTRIBUTING.md

Lines changed: 332 additions & 0 deletions
Large diffs are not rendered by default.

bittensor_cli/cli.py

Lines changed: 219 additions & 72 deletions
Large diffs are not rendered by default.

bittensor_cli/src/bittensor/extrinsics/registration.py

Lines changed: 31 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
from bittensor_cli.src.bittensor.utils import (
3333
confirm_action,
3434
console,
35-
err_console,
35+
print_error,
36+
print_success,
3637
format_error_message,
3738
millify,
3839
get_human_readable,
@@ -94,7 +95,7 @@ def _get_real_torch():
9495

9596

9697
def log_no_torch_error():
97-
err_console.print(
98+
print_error(
9899
"This command requires torch. You can install torch"
99100
" with `pip install torch` and run the command again."
100101
)
@@ -509,8 +510,8 @@ async def get_neuron_for_pubkey_and_subnet():
509510

510511
print_verbose("Checking subnet status")
511512
if not await subtensor.subnet_exists(netuid):
512-
err_console.print(
513-
f":cross_mark: [red]Failed[/red]: error: [bold white]subnet:{netuid}[/bold white] does not exist."
513+
print_error(
514+
f"Failed: error: [bold white]subnet:{netuid}[/bold white] does not exist."
514515
)
515516
return False
516517

@@ -587,8 +588,8 @@ async def get_neuron_for_pubkey_and_subnet():
587588
subtensor, netuid=netuid, hotkey_ss58=get_hotkey_pub_ss58(wallet)
588589
)
589590
if is_registered:
590-
err_console.print(
591-
f":white_heavy_check_mark: [dark_sea_green3]Already registered on netuid:{netuid}[/dark_sea_green3]"
591+
print_success(
592+
f"[dark_sea_green3]Already registered on netuid:{netuid}[/dark_sea_green3]"
592593
)
593594
return True
594595

@@ -630,14 +631,12 @@ async def get_neuron_for_pubkey_and_subnet():
630631
# https://github.com/opentensor/subtensor/blob/development/pallets/subtensor/src/errors.rs
631632

632633
if "HotKeyAlreadyRegisteredInSubNet" in err_msg:
633-
console.print(
634-
f":white_heavy_check_mark: [dark_sea_green3]Already Registered on "
634+
print_success(
635+
f"[dark_sea_green3]Already Registered on "
635636
f"[bold]subnet:{netuid}[/bold][/dark_sea_green3]"
636637
)
637638
return True
638-
err_console.print(
639-
f":cross_mark: [red]Failed[/red]: {err_msg}"
640-
)
639+
print_error(f"Failed: {err_msg}")
641640
await asyncio.sleep(0.5)
642641

643642
# Successful registration, final check for neuron and pubkey
@@ -649,31 +648,29 @@ async def get_neuron_for_pubkey_and_subnet():
649648
hotkey_ss58=get_hotkey_pub_ss58(wallet),
650649
)
651650
if is_registered:
652-
console.print(
653-
":white_heavy_check_mark: [dark_sea_green3]Registered[/dark_sea_green3]"
651+
print_success(
652+
"[dark_sea_green3]Registered[/dark_sea_green3]"
654653
)
655654
return True
656655
else:
657656
# neuron not found, try again
658-
err_console.print(
659-
":cross_mark: [red]Unknown error. Neuron not found.[/red]"
660-
)
657+
print_error("Unknown error. Neuron not found.")
661658
continue
662659
else:
663660
# Exited loop because pow is no longer valid.
664-
err_console.print("[red]POW is stale.[/red]")
661+
print_error("POW is stale.")
665662
# Try again.
666663
continue
667664

668665
if attempts < max_allowed_attempts:
669666
# Failed registration, retry pow
670667
attempts += 1
671-
err_console.print(
668+
print_error(
672669
":satellite: Failed registration, retrying pow ...({attempts}/{max_allowed_attempts})"
673670
)
674671
else:
675672
# Failed to register after max attempts.
676-
err_console.print("[red]No more attempts.[/red]")
673+
print_error("No more attempts.")
677674
return False
678675

679676

@@ -742,8 +739,8 @@ async def burned_register_extrinsic(
742739
era_ = {"period": era}
743740

744741
if not neuron.is_null:
742+
print_success("[dark_sea_green3]Already Registered[/dark_sea_green3]:")
745743
console.print(
746-
":white_heavy_check_mark: [dark_sea_green3]Already Registered[/dark_sea_green3]:\n"
747744
f"uid: [{COLOR_PALETTE.G.NETUID_EXTRA}]{neuron.uid}[/{COLOR_PALETTE.G.NETUID_EXTRA}]\n"
748745
f"netuid: [{COLOR_PALETTE.G.NETUID}]{neuron.netuid}[/{COLOR_PALETTE.G.NETUID}]\n"
749746
f"hotkey: [{COLOR_PALETTE.G.HK}]{neuron.hotkey}[/{COLOR_PALETTE.G.HK}]\n"
@@ -772,7 +769,7 @@ async def burned_register_extrinsic(
772769
)
773770

774771
if not success:
775-
err_console.print(f":cross_mark: [red]Failed[/red]: {err_msg}")
772+
print_error(f"Failed: {err_msg}")
776773
await asyncio.sleep(0.5)
777774
return False, err_msg, None
778775
# Successful registration, final check for neuron and pubkey
@@ -802,15 +799,11 @@ async def burned_register_extrinsic(
802799
)
803800

804801
if len(netuids_for_hotkey) > 0:
805-
console.print(
806-
f":white_heavy_check_mark: [green]Registered on netuid {netuid} with UID {my_uid}[/green]"
807-
)
802+
print_success(f"Registered on netuid {netuid} with UID {my_uid}")
808803
return True, f"Registered on {netuid} with UID {my_uid}", ext_id
809804
else:
810805
# neuron not found, try again
811-
err_console.print(
812-
":cross_mark: [red]Unknown error. Neuron not found.[/red]"
813-
)
806+
print_error("Unknown error. Neuron not found.")
814807
return False, "Unknown error. Neuron not found.", ext_id
815808

816809

@@ -891,7 +884,7 @@ async def run_faucet_extrinsic(
891884
if cuda:
892885
if not torch.cuda.is_available():
893886
if prompt:
894-
err_console.print("CUDA is not available.")
887+
print_error("CUDA is not available.")
895888
return False, "CUDA is not available."
896889
pow_result = await create_pow(
897890
subtensor,
@@ -936,9 +929,8 @@ async def run_faucet_extrinsic(
936929

937930
# process if registration successful, try again if pow is still valid
938931
if not await response.is_success:
939-
err_console.print(
940-
f":cross_mark: [red]Failed[/red]: "
941-
f"{format_error_message(await response.error_message)}"
932+
print_error(
933+
f"Failed: {format_error_message(await response.error_message)}"
942934
)
943935
if attempts == max_allowed_attempts:
944936
raise MaxAttemptsException
@@ -1788,29 +1780,29 @@ async def swap_hotkey_extrinsic(
17881780
)
17891781

17901782
if netuid is not None and netuid not in netuids_registered:
1791-
err_console.print(
1792-
f":cross_mark: [red]Failed[/red]: Original hotkey {hk_ss58} is not registered on subnet {netuid}"
1783+
print_error(
1784+
f"Failed: Original hotkey {hk_ss58} is not registered on subnet {netuid}"
17931785
)
17941786
return False, None
17951787

17961788
elif not len(netuids_registered) > 0:
1797-
err_console.print(
1789+
print_error(
17981790
f"Original hotkey [dark_orange]{hk_ss58}[/dark_orange] is not registered on any subnet. "
17991791
f"Please register and try again"
18001792
)
18011793
return False, None
18021794

18031795
if netuid is not None:
18041796
if netuid in netuids_registered_new_hotkey:
1805-
err_console.print(
1806-
f":cross_mark: [red]Failed[/red]: New hotkey {new_hk_ss58} "
1797+
print_error(
1798+
f"Failed: New hotkey {new_hk_ss58} "
18071799
f"is already registered on subnet {netuid}"
18081800
)
18091801
return False, None
18101802
else:
18111803
if len(netuids_registered_new_hotkey) > 0:
1812-
err_console.print(
1813-
f":cross_mark: [red]Failed[/red]: New hotkey {new_hk_ss58} "
1804+
print_error(
1805+
f"Failed: New hotkey {new_hk_ss58} "
18141806
f"is already registered on subnet(s) {netuids_registered_new_hotkey}"
18151807
)
18161808
return False, None
@@ -1864,6 +1856,6 @@ async def swap_hotkey_extrinsic(
18641856
)
18651857
return True, ext_receipt
18661858
else:
1867-
err_console.print(f":cross_mark: [red]Failed[/red]: {err_msg}")
1859+
print_error(f"Failed: {err_msg}")
18681860
time.sleep(0.5)
18691861
return False, ext_receipt

bittensor_cli/src/bittensor/extrinsics/root.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
from bittensor_cli.src.bittensor.utils import (
3232
confirm_action,
3333
console,
34-
err_console,
34+
print_error,
35+
print_success,
3536
u16_normalized_float,
3637
print_verbose,
3738
format_error_message,
@@ -343,9 +344,7 @@ async def root_register_extrinsic(
343344
subtensor, netuid=0, hotkey_ss58=get_hotkey_pub_ss58(wallet)
344345
)
345346
if is_registered:
346-
console.print(
347-
":white_heavy_check_mark: [green]Already registered on root network.[/green]"
348-
)
347+
print_success("Already registered on root network.")
349348
return True, "Already registered on root network", None
350349

351350
with console.status(":satellite: Registering to root network...", spinner="earth"):
@@ -363,7 +362,7 @@ async def root_register_extrinsic(
363362
)
364363

365364
if not success:
366-
err_console.print(f":cross_mark: [red]Failed[/red]: {err_msg}")
365+
print_error(f"Failed: {err_msg}")
367366
await asyncio.sleep(0.5)
368367
return False, err_msg, None
369368

@@ -377,15 +376,11 @@ async def root_register_extrinsic(
377376
params=[0, get_hotkey_pub_ss58(wallet)],
378377
)
379378
if uid is not None:
380-
console.print(
381-
f":white_heavy_check_mark: [green]Registered with UID {uid}[/green]"
382-
)
379+
print_success(f"Registered with UID {uid}")
383380
return True, f"Registered with UID {uid}", ext_id
384381
else:
385382
# neuron not found, try again
386-
err_console.print(
387-
":cross_mark: [red]Unknown error. Neuron not found.[/red]"
388-
)
383+
print_error("Unknown error. Neuron not found.")
389384
return False, "Unknown error. Neuron not found.", ext_id
390385

391386

@@ -454,7 +449,7 @@ async def _do_set_weights():
454449
)
455450

456451
if my_uid is None:
457-
err_console.print("Your hotkey is not registered to the root network")
452+
print_error("Your hotkey is not registered to the root network")
458453
return False
459454

460455
if not unlock_key(wallet).success:
@@ -542,14 +537,14 @@ async def _do_set_weights():
542537
return True
543538

544539
if success is True:
545-
console.print(":white_heavy_check_mark: [green]Finalized[/green]")
540+
print_success("Finalized")
546541
return True
547542
else:
548543
fmt_err = format_error_message(error_message)
549-
err_console.print(f":cross_mark: [red]Failed[/red]: {fmt_err}")
544+
print_error(f"Failed: {fmt_err}")
550545
return False
551546

552547
except SubstrateRequestException as e:
553548
fmt_err = format_error_message(e)
554-
err_console.print(":cross_mark: [red]Failed[/red]: error:{}".format(fmt_err))
549+
print_error("Failed: error:{}".format(fmt_err))
555550
return False

bittensor_cli/src/bittensor/extrinsics/serving.py

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
from bittensor_cli.src.bittensor.utils import (
1111
confirm_action,
1212
console,
13-
err_console,
13+
print_error,
14+
print_success,
1415
format_error_message,
1516
unlock_key,
1617
print_extrinsic_id,
@@ -112,29 +113,27 @@ async def reset_axon_extrinsic(
112113

113114
# We only wait here if we expect finalization.
114115
if not wait_for_finalization and not wait_for_inclusion:
115-
console.print(
116-
":white_heavy_check_mark: [dark_sea_green3]Axon reset successfully[/dark_sea_green3]"
116+
print_success(
117+
"[dark_sea_green3]Axon reset successfully[/dark_sea_green3]"
117118
)
118119
return True, "Not waiting for finalization or inclusion.", None
119120

120121
success = await response.is_success
121122
if not success:
122123
error_msg = format_error_message(await response.error_message)
123-
err_console.print(f":cross_mark: [red]Failed[/red]: {error_msg}")
124+
print_error(f"Failed: {error_msg}")
124125
return False, error_msg, None
125126
else:
126127
ext_id = await response.get_extrinsic_identifier()
127128
await print_extrinsic_id(response)
128-
console.print(
129-
":white_heavy_check_mark: [dark_sea_green3]Axon reset successfully[/dark_sea_green3]"
129+
print_success(
130+
"[dark_sea_green3]Axon reset successfully[/dark_sea_green3]"
130131
)
131132
return True, "Axon reset successfully", ext_id
132133

133134
except Exception as e:
134135
error_message = format_error_message(e)
135-
err_console.print(
136-
f":cross_mark: [red]Failed to reset axon: {error_message}[/red]"
137-
)
136+
print_error(f"Failed to reset axon: {error_message}")
138137
return False, error_message, None
139138

140139

@@ -232,27 +231,25 @@ async def set_axon_extrinsic(
232231

233232
# We only wait here if we expect finalization.
234233
if not wait_for_finalization and not wait_for_inclusion:
235-
console.print(
236-
f":white_heavy_check_mark: [dark_sea_green3]Axon set successfully to {ip}:{port}[/dark_sea_green3]"
234+
print_success(
235+
f"[dark_sea_green3]Axon set successfully to {ip}:{port}[/dark_sea_green3]"
237236
)
238237
return True, "Not waiting for finalization or inclusion.", None
239238

240239
success = await response.is_success
241240
if not success:
242241
error_msg = format_error_message(await response.error_message)
243-
err_console.print(f":cross_mark: [red]Failed[/red]: {error_msg}")
242+
print_error(f"Failed: {error_msg}")
244243
return False, error_msg, None
245244
else:
246245
ext_id = await response.get_extrinsic_identifier()
247246
await print_extrinsic_id(response)
248-
console.print(
249-
f":white_heavy_check_mark: [dark_sea_green3]Axon set successfully to {ip}:{port}[/dark_sea_green3]"
247+
print_success(
248+
f"[dark_sea_green3]Axon set successfully to {ip}:{port}[/dark_sea_green3]"
250249
)
251250
return True, f"Axon set successfully to {ip}:{port}", ext_id
252251

253252
except Exception as e:
254253
error_message = format_error_message(e)
255-
err_console.print(
256-
f":cross_mark: [red]Failed to set axon: {error_message}[/red]"
257-
)
254+
print_error(f"Failed to set axon: {error_message}")
258255
return False, error_message, None

0 commit comments

Comments
 (0)