Skip to content

Commit bc421be

Browse files
authored
Merge pull request #555 from opentensor/release/9.8.6
Release/9.8.6
2 parents af10b45 + 53ee0a4 commit bc421be

File tree

6 files changed

+74
-31
lines changed

6 files changed

+74
-31
lines changed

CHANGELOG.md

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

3+
## 9.8.6 /2025-07-22
4+
* Hyperparam discrepancy between set/get by @thewhaleking in https://github.com/opentensor/btcli/pull/552
5+
* Hyperparameters in alphabetical order for `btcli sudo get/set` by @basfroman in https://github.com/opentensor/btcli/pull/553
6+
7+
**Full Changelog**: https://github.com/opentensor/btcli/compare/v9.8.5...v9.8.6
8+
39
## 9.8.5 /2025-07-16
410
* Updates `user_liquidity_enabled` to not root sudo only. by @thewhaleking in https://github.com/opentensor/btcli/pull/546
511
* Patches broken Brahmi characters with normal characters. by @thewhaleking in https://github.com/opentensor/btcli/pull/547

bittensor_cli/cli.py

Lines changed: 51 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,8 @@ def initialize_chain(
10701070
not_selected_networks = [net for net in network if net != network_]
10711071
if not_selected_networks:
10721072
console.print(
1073-
f"Networks not selected: [dark_orange]{', '.join(not_selected_networks)}[/dark_orange]"
1073+
f"Networks not selected: "
1074+
f"[{COLORS.G.ARG}]{', '.join(not_selected_networks)}[/{COLORS.G.ARG}]"
10741075
)
10751076

10761077
self.subtensor = SubtensorInterface(network_)
@@ -1353,8 +1354,8 @@ def set_config(
13531354
if n := args.get("network"):
13541355
if n in Constants.networks:
13551356
if not Confirm.ask(
1356-
f"You provided a network [dark_orange]{n}[/dark_orange] which is mapped to "
1357-
f"[dark_orange]{Constants.network_map[n]}[/dark_orange]\n"
1357+
f"You provided a network [{COLORS.G.ARG}]{n}[/{COLORS.G.ARG}] which is mapped to "
1358+
f"[{COLORS.G.ARG}]{Constants.network_map[n]}[/{COLORS.G.ARG}]\n"
13581359
"Do you want to continue?"
13591360
):
13601361
typer.Exit()
@@ -1369,14 +1370,14 @@ def set_config(
13691370
)
13701371
args["network"] = known_network
13711372
if not Confirm.ask(
1372-
f"You provided an endpoint [dark_orange]{n}[/dark_orange] which is mapped to "
1373-
f"[dark_orange]{known_network}[/dark_orange]\n"
1373+
f"You provided an endpoint [{COLORS.G.ARG}]{n}[/{COLORS.G.ARG}] which is mapped to "
1374+
f"[{COLORS.G.ARG}]{known_network}[/{COLORS.G.ARG}]\n"
13741375
"Do you want to continue?"
13751376
):
1376-
typer.Exit()
1377+
raise typer.Exit()
13771378
else:
13781379
if not Confirm.ask(
1379-
f"You provided a chain endpoint URL [dark_orange]{n}[/dark_orange]\n"
1380+
f"You provided a chain endpoint URL [{COLORS.G.ARG}]{n}[/{COLORS.G.ARG}]\n"
13801381
"Do you want to continue?"
13811382
):
13821383
raise typer.Exit()
@@ -1451,15 +1452,15 @@ def del_config(
14511452
for arg in args.keys():
14521453
if self.config.get(arg) is not None:
14531454
if Confirm.ask(
1454-
f"Do you want to clear the [dark_orange]{arg}[/dark_orange] config?"
1455+
f"Do you want to clear the [{COLORS.G.ARG}]{arg}[/{COLORS.G.ARG}] config?"
14551456
):
14561457
self.config[arg] = None
14571458
console.print(
1458-
f"Cleared [dark_orange]{arg}[/dark_orange] config and set to 'None'."
1459+
f"Cleared [{COLORS.G.ARG}]{arg}[/{COLORS.G.ARG}] config and set to 'None'."
14591460
)
14601461
else:
14611462
console.print(
1462-
f"Skipped clearing [dark_orange]{arg}[/dark_orange] config."
1463+
f"Skipped clearing [{COLORS.G.ARG}]{arg}[/{COLORS.G.ARG}] config."
14631464
)
14641465

14651466
else:
@@ -1468,19 +1469,21 @@ def del_config(
14681469
if should_clear:
14691470
if self.config.get(arg) is not None:
14701471
if Confirm.ask(
1471-
f"Do you want to clear the [dark_orange]{arg}[/dark_orange] [bold cyan]({self.config.get(arg)})[/bold cyan] config?"
1472+
f"Do you want to clear the [{COLORS.G.ARG}]{arg}[/{COLORS.G.ARG}]"
1473+
f" [bold cyan]({self.config.get(arg)})[/bold cyan] config?"
14721474
):
14731475
self.config[arg] = None
14741476
console.print(
1475-
f"Cleared [dark_orange]{arg}[/dark_orange] config and set to 'None'."
1477+
f"Cleared [{COLORS.G.ARG}]{arg}[/{COLORS.G.ARG}] config and set to 'None'."
14761478
)
14771479
else:
14781480
console.print(
1479-
f"Skipped clearing [dark_orange]{arg}[/dark_orange] config."
1481+
f"Skipped clearing [{COLORS.G.ARG}]{arg}[/{COLORS.G.ARG}] config."
14801482
)
14811483
else:
14821484
console.print(
1483-
f"No config set for [dark_orange]{arg}[/dark_orange]. Use `btcli config set` to set it."
1485+
f"No config set for [{COLORS.G.ARG}]{arg}[/{COLORS.G.ARG}]."
1486+
f" Use [{COLORS.G.ARG}]`btcli config set`[/{COLORS.G.ARG}] to set it."
14841487
)
14851488
with open(self.config_path, "w") as f:
14861489
safe_dump(self.config, f)
@@ -1492,7 +1495,7 @@ def get_config(self):
14921495
deprecated_configs = ["chain"]
14931496

14941497
table = Table(
1495-
Column("[bold white]Name", style="dark_orange"),
1498+
Column("[bold white]Name", style=f"{COLORS.G.ARG}"),
14961499
Column("[bold white]Value", style="gold1"),
14971500
Column("", style="medium_purple"),
14981501
box=box.SIMPLE_HEAD,
@@ -4594,7 +4597,9 @@ def sudo_set(
45944597
"Param name not supplied with `--no-prompt` flag. Cannot continue"
45954598
)
45964599
return False
4597-
hyperparam_list = [field.name for field in fields(SubnetHyperparameters)]
4600+
hyperparam_list = sorted(
4601+
[field.name for field in fields(SubnetHyperparameters)]
4602+
)
45984603
console.print("Available hyperparameters:\n")
45994604
for idx, param in enumerate(hyperparam_list, start=1):
46004605
console.print(f" {idx}. {param}")
@@ -4609,17 +4614,44 @@ def sudo_set(
46094614
if param_name in ["alpha_high", "alpha_low"]:
46104615
if not prompt:
46114616
err_console.print(
4612-
"`alpha_high` and `alpha_low` values cannot be set with `--no-prompt`"
4617+
f"[{COLORS.SU.HYPERPARAM}]alpha_high[/{COLORS.SU.HYPERPARAM}] and "
4618+
f"[{COLORS.SU.HYPERPARAM}]alpha_low[/{COLORS.SU.HYPERPARAM}] "
4619+
f"values cannot be set with `--no-prompt`"
46134620
)
46144621
return False
46154622
param_name = "alpha_values"
46164623
low_val = FloatPrompt.ask(
4617-
"Enter the new value for [dark_orange]alpha_low[/dark_orange]"
4624+
f"Enter the new value for [{COLORS.G.ARG}]alpha_low[/{COLORS.G.ARG}]"
46184625
)
46194626
high_val = FloatPrompt.ask(
4620-
"Enter the new value for [dark_orange]alpha_high[/dark_orange]"
4627+
f"Enter the new value for [{COLORS.G.ARG}]alpha_high[/{COLORS.G.ARG}]"
46214628
)
46224629
param_value = f"{low_val},{high_val}"
4630+
if param_name == "yuma_version":
4631+
if not prompt:
4632+
err_console.print(
4633+
f"[{COLORS.SU.HYPERPARAM}]yuma_version[/{COLORS.SU.HYPERPARAM}]"
4634+
f" is set using a different hyperparameter, and thus cannot be set with `--no-prompt`"
4635+
)
4636+
return False
4637+
if Confirm.ask(
4638+
f"[{COLORS.SU.HYPERPARAM}]yuma_version[/{COLORS.SU.HYPERPARAM}] can only be used to toggle Yuma 3. "
4639+
f"Would you like to toggle Yuma 3?"
4640+
):
4641+
param_name = "yuma3_enabled"
4642+
question = Prompt.ask(
4643+
"Would to like to enable or disable Yuma 3?",
4644+
choices=["enable", "disable"],
4645+
)
4646+
param_value = "true" if question == "enable" else "false"
4647+
else:
4648+
return False
4649+
if param_name == "subnet_is_active":
4650+
err_console.print(
4651+
f"[{COLORS.SU.HYPERPARAM}]subnet_is_active[/{COLORS.SU.HYPERPARAM}] "
4652+
f"is set by using [{COLORS.G.ARG}]`btcli subnets start`[/{COLORS.G.ARG}] command."
4653+
)
4654+
return False
46234655

46244656
if not param_value:
46254657
if not prompt:

bittensor_cli/src/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,8 @@ class WalletValidationTypes(Enum):
661661
"yuma3_enabled": ("sudo_set_yuma3_enabled", False),
662662
"alpha_sigmoid_steepness": ("sudo_set_alpha_sigmoid_steepness", True),
663663
"user_liquidity_enabled": ("toggle_user_liquidity", False),
664+
"bonds_reset_enabled": ("sudo_set_bonds_reset_enabled", False),
665+
"transfers_enabled": ("sudo_set_toggle_transfer", False),
664666
}
665667

666668
HYPERPARAMS_MODULE = {
@@ -747,6 +749,7 @@ class General(Gettable):
747749
NETUID = "#CBA880" # Tan
748750
NETUID_EXTRA = "#DDD5A9" # Light Khaki
749751
TEMPO = "#67A3A5" # Grayish Teal
752+
ARG = "dark_orange"
750753
# aliases
751754
CK = COLDKEY
752755
HK = HOTKEY

bittensor_cli/src/commands/sudo.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,8 @@ async def get_hyperparameters(
671671
dict_out = []
672672

673673
normalized_values = normalize_hyperparameters(subnet, json_output=json_output)
674-
for param, value, norm_value in normalized_values:
674+
sorted_values = sorted(normalized_values, key=lambda x: x[0])
675+
for param, value, norm_value in sorted_values:
675676
if not json_output:
676677
table.add_row(" " + param, value, norm_value)
677678
else:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "bittensor-cli"
7-
version = "9.8.5"
7+
version = "9.8.6"
88
description = "Bittensor CLI"
99
readme = "README.md"
1010
authors = [

tests/e2e_tests/test_staking_sudo.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -396,20 +396,17 @@ def test_staking(local_chain, wallet_setup):
396396
hyperparams = exec_command_alice(
397397
command="sudo",
398398
sub_command="get",
399-
extra_args=[
400-
"--chain",
401-
"ws://127.0.0.1:9945",
402-
"--netuid",
403-
netuid,
404-
],
399+
extra_args=["--chain", "ws://127.0.0.1:9945", "--netuid", netuid, "--json-out"],
405400
)
406401

407402
# Parse all hyperparameters and single out max_burn in TAO
408-
all_hyperparams = hyperparams.stdout.splitlines()
409-
max_burn_tao = all_hyperparams[22].split()[2].strip("\u200e")
403+
all_hyperparams = json.loads(hyperparams.stdout)
404+
max_burn_tao = next(
405+
filter(lambda x: x["hyperparameter"] == "max_burn", all_hyperparams)
406+
)["value"]
410407

411408
# Assert max_burn is 100 TAO from default
412-
assert Balance.from_tao(float(max_burn_tao)) == Balance.from_tao(100.0)
409+
assert Balance.from_rao(int(max_burn_tao)) == Balance.from_tao(100.0)
413410

414411
hyperparams_json = exec_command_alice(
415412
command="sudo",
@@ -468,7 +465,11 @@ def test_staking(local_chain, wallet_setup):
468465

469466
# Parse updated hyperparameters
470467
all_updated_hyperparams = updated_hyperparams.stdout.splitlines()
471-
updated_max_burn_tao = all_updated_hyperparams[22].split()[2].strip("\u200e")
468+
updated_max_burn_tao = (
469+
next(filter(lambda x: x[3:11] == "max_burn", all_updated_hyperparams))
470+
.split()[2]
471+
.strip("\u200e")
472+
)
472473

473474
# Assert max_burn is now 10 TAO
474475
assert Balance.from_tao(float(updated_max_burn_tao)) == Balance.from_tao(10)

0 commit comments

Comments
 (0)