Skip to content

Commit 31379f1

Browse files
authored
Merge pull request #656 from opentensor/release/9.13.1
Release/9.13.1
2 parents e926be8 + 4e476b0 commit 31379f1

File tree

13 files changed

+171
-129
lines changed

13 files changed

+171
-129
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.13.1 /2025-10-14
4+
* Fix for complicated (user_liquidity_enabled) hyperparams by @thewhaleking in https://github.com/opentensor/btcli/pull/652
5+
* Fixes a number of type annotations by @thewhaleking in https://github.com/opentensor/btcli/pull/653
6+
7+
**Full Changelog**: https://github.com/opentensor/btcli/compare/v9.13.0...v9.13.1
8+
39
## 9.13.0 /2025-10-09
410

511
## What's Changed

bittensor_cli/cli.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3658,7 +3658,6 @@ def get_auto_stake(
36583658
self.initialize_chain(network),
36593659
coldkey_ss58=coldkey_ss58,
36603660
json_output=json_output,
3661-
verbose=verbose,
36623661
)
36633662
)
36643663

bittensor_cli/src/__init__.py

Lines changed: 49 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -626,47 +626,62 @@ class WalletValidationTypes(Enum):
626626
}
627627

628628

629+
class RootSudoOnly(Enum):
630+
FALSE = 0
631+
TRUE = 1
632+
COMPLICATED = 2
633+
634+
629635
HYPERPARAMS = {
630-
# btcli name: (subtensor method, root-only bool)
631-
"rho": ("sudo_set_rho", False),
632-
"kappa": ("sudo_set_kappa", False),
633-
"immunity_period": ("sudo_set_immunity_period", False),
634-
"min_allowed_weights": ("sudo_set_min_allowed_weights", False),
635-
"max_weights_limit": ("sudo_set_max_weight_limit", False),
636-
"tempo": ("sudo_set_tempo", True),
637-
"min_difficulty": ("sudo_set_min_difficulty", True),
638-
"max_difficulty": ("sudo_set_max_difficulty", False),
639-
"weights_version": ("sudo_set_weights_version_key", False),
640-
"weights_rate_limit": ("sudo_set_weights_set_rate_limit", True),
641-
"adjustment_interval": ("sudo_set_adjustment_interval", True),
642-
"activity_cutoff": ("sudo_set_activity_cutoff", False),
643-
"target_regs_per_interval": ("sudo_set_target_registrations_per_interval", True),
644-
"min_burn": ("sudo_set_min_burn", False),
645-
"max_burn": ("sudo_set_max_burn", True),
646-
"bonds_moving_avg": ("sudo_set_bonds_moving_average", False),
647-
"max_regs_per_block": ("sudo_set_max_registrations_per_block", True),
648-
"serving_rate_limit": ("sudo_set_serving_rate_limit", False),
649-
"max_validators": ("sudo_set_max_allowed_validators", True),
650-
"adjustment_alpha": ("sudo_set_adjustment_alpha", False),
651-
"difficulty": ("sudo_set_difficulty", True),
636+
# btcli name: (subtensor method, root-only enum)
637+
"rho": ("sudo_set_rho", RootSudoOnly.FALSE),
638+
"kappa": ("sudo_set_kappa", RootSudoOnly.FALSE),
639+
"immunity_period": ("sudo_set_immunity_period", RootSudoOnly.FALSE),
640+
"min_allowed_weights": ("sudo_set_min_allowed_weights", RootSudoOnly.FALSE),
641+
"max_weights_limit": ("sudo_set_max_weight_limit", RootSudoOnly.FALSE),
642+
"tempo": ("sudo_set_tempo", RootSudoOnly.TRUE),
643+
"min_difficulty": ("sudo_set_min_difficulty", RootSudoOnly.TRUE),
644+
"max_difficulty": ("sudo_set_max_difficulty", RootSudoOnly.FALSE),
645+
"weights_version": ("sudo_set_weights_version_key", RootSudoOnly.FALSE),
646+
"weights_rate_limit": ("sudo_set_weights_set_rate_limit", RootSudoOnly.TRUE),
647+
"adjustment_interval": ("sudo_set_adjustment_interval", RootSudoOnly.TRUE),
648+
"activity_cutoff": ("sudo_set_activity_cutoff", RootSudoOnly.FALSE),
649+
"target_regs_per_interval": (
650+
"sudo_set_target_registrations_per_interval",
651+
RootSudoOnly.TRUE,
652+
),
653+
"min_burn": ("sudo_set_min_burn", RootSudoOnly.FALSE),
654+
"max_burn": ("sudo_set_max_burn", RootSudoOnly.TRUE),
655+
"bonds_moving_avg": ("sudo_set_bonds_moving_average", RootSudoOnly.FALSE),
656+
"max_regs_per_block": ("sudo_set_max_registrations_per_block", RootSudoOnly.TRUE),
657+
"serving_rate_limit": ("sudo_set_serving_rate_limit", RootSudoOnly.FALSE),
658+
"max_validators": ("sudo_set_max_allowed_validators", RootSudoOnly.TRUE),
659+
"adjustment_alpha": ("sudo_set_adjustment_alpha", RootSudoOnly.FALSE),
660+
"difficulty": ("sudo_set_difficulty", RootSudoOnly.TRUE),
652661
"commit_reveal_period": (
653662
"sudo_set_commit_reveal_weights_interval",
654-
False,
663+
RootSudoOnly.FALSE,
664+
),
665+
"commit_reveal_weights_enabled": (
666+
"sudo_set_commit_reveal_weights_enabled",
667+
RootSudoOnly.FALSE,
668+
),
669+
"alpha_values": ("sudo_set_alpha_values", RootSudoOnly.FALSE),
670+
"liquid_alpha_enabled": ("sudo_set_liquid_alpha_enabled", RootSudoOnly.FALSE),
671+
"registration_allowed": (
672+
"sudo_set_network_registration_allowed",
673+
RootSudoOnly.TRUE,
655674
),
656-
"commit_reveal_weights_enabled": ("sudo_set_commit_reveal_weights_enabled", False),
657-
"alpha_values": ("sudo_set_alpha_values", False),
658-
"liquid_alpha_enabled": ("sudo_set_liquid_alpha_enabled", False),
659-
"registration_allowed": ("sudo_set_network_registration_allowed", True),
660675
"network_pow_registration_allowed": (
661676
"sudo_set_network_pow_registration_allowed",
662-
False,
677+
RootSudoOnly.FALSE,
663678
),
664-
"yuma3_enabled": ("sudo_set_yuma3_enabled", False),
665-
"alpha_sigmoid_steepness": ("sudo_set_alpha_sigmoid_steepness", True),
666-
"user_liquidity_enabled": ("toggle_user_liquidity", True),
667-
"bonds_reset_enabled": ("sudo_set_bonds_reset_enabled", False),
668-
"transfers_enabled": ("sudo_set_toggle_transfer", False),
669-
"min_allowed_uids": ("sudo_set_min_allowed_uids", True),
679+
"yuma3_enabled": ("sudo_set_yuma3_enabled", RootSudoOnly.FALSE),
680+
"alpha_sigmoid_steepness": ("sudo_set_alpha_sigmoid_steepness", RootSudoOnly.TRUE),
681+
"user_liquidity_enabled": ("toggle_user_liquidity", RootSudoOnly.COMPLICATED),
682+
"bonds_reset_enabled": ("sudo_set_bonds_reset_enabled", RootSudoOnly.FALSE),
683+
"transfers_enabled": ("sudo_set_toggle_transfer", RootSudoOnly.FALSE),
684+
"min_allowed_uids": ("sudo_set_min_allowed_uids", RootSudoOnly.TRUE),
670685
}
671686

672687
HYPERPARAMS_MODULE = {

bittensor_cli/src/bittensor/subtensor_interface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ async def get_total_stake_for_hotkey(
500500

501501
async def current_take(
502502
self,
503-
hotkey_ss58: int,
503+
hotkey_ss58: str,
504504
block_hash: Optional[str] = None,
505505
reuse_block: bool = False,
506506
) -> Optional[float]:

bittensor_cli/src/commands/liquidity/liquidity.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ async def show_liquidity_list(
458458
wallet: "Wallet",
459459
netuid: int,
460460
json_output: bool = False,
461-
):
461+
) -> None:
462462
current_price_, (success, err_msg, positions) = await asyncio.gather(
463463
subtensor.subnet(netuid=netuid), get_liquidity_list(subtensor, wallet, netuid)
464464
)
@@ -467,10 +467,10 @@ async def show_liquidity_list(
467467
json_console.print(
468468
json.dumps({"success": success, "err_msg": err_msg, "positions": []})
469469
)
470-
return False
470+
return
471471
else:
472472
err_console.print(f"Error: {err_msg}")
473-
return False
473+
return
474474
liquidity_table = Table(
475475
Column("ID", justify="center"),
476476
Column("Liquidity", justify="center"),
@@ -535,10 +535,10 @@ async def remove_liquidity(
535535
prompt: Optional[bool] = None,
536536
all_liquidity_ids: Optional[bool] = None,
537537
json_output: bool = False,
538-
) -> tuple[bool, str]:
538+
) -> None:
539539
"""Remove liquidity position from provided subnet."""
540540
if not await subtensor.subnet_exists(netuid=netuid):
541-
return False, f"Subnet with netuid: {netuid} does not exist in {subtensor}."
541+
return None
542542

543543
if all_liquidity_ids:
544544
success, msg, positions = await get_liquidity_list(subtensor, wallet, netuid)
@@ -549,7 +549,7 @@ async def remove_liquidity(
549549
)
550550
else:
551551
return err_console.print(f"Error: {msg}")
552-
return False, msg
552+
return None
553553
else:
554554
position_ids = [p.id for p in positions]
555555
else:
@@ -563,7 +563,7 @@ async def remove_liquidity(
563563
console.print(f"\tPosition id: {pos}")
564564

565565
if not Confirm.ask("Would you like to continue?"):
566-
return False, "User cancelled operation."
566+
return None
567567

568568
results = await asyncio.gather(
569569
*[
@@ -593,6 +593,7 @@ async def remove_liquidity(
593593
"extrinsic_identifier": await ext_receipt.get_extrinsic_identifier(),
594594
}
595595
json_console.print_json(data=json_table)
596+
return None
596597

597598

598599
async def modify_liquidity(

bittensor_cli/src/commands/liquidity/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,3 +198,5 @@ def prompt_position_id() -> int:
198198
return position_id
199199
except ValueError:
200200
console.print("[red]Please enter a valid number[/red].")
201+
# will never return this, but fixes the type checker
202+
return 0

bittensor_cli/src/commands/stake/add.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import asyncio
2-
import json
32
from collections import defaultdict
43
from functools import partial
54

@@ -349,7 +348,7 @@ async def stake_extrinsic(
349348
f"[red]Not enough stake[/red]:[bold white]\n wallet balance:{remaining_wallet_balance} < "
350349
f"staking amount: {amount_to_stake}[/bold white]"
351350
)
352-
return False
351+
return
353352
remaining_wallet_balance -= amount_to_stake
354353

355354
# Calculate slippage
@@ -432,9 +431,9 @@ async def stake_extrinsic(
432431

433432
if prompt:
434433
if not Confirm.ask("Would you like to continue?"):
435-
return False
434+
return
436435
if not unlock_key(wallet).success:
437-
return False
436+
return
438437

439438
if safe_staking:
440439
stake_coroutines = {}
@@ -537,6 +536,8 @@ def _prompt_stake_amount(
537536
return Balance.from_tao(amount), False
538537
except ValueError:
539538
console.print("[red]Please enter a valid number or 'all'[/red]")
539+
# will never return this, but fixes the type checker
540+
return Balance(0), False
540541

541542

542543
def _get_hotkeys_to_stake_to(

bittensor_cli/src/commands/stake/auto_staking.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ async def show_auto_stake_destinations(
2828
subtensor: "SubtensorInterface",
2929
coldkey_ss58: Optional[str] = None,
3030
json_output: bool = False,
31-
verbose: bool = False,
3231
) -> Optional[dict[int, dict[str, Optional[str]]]]:
3332
"""Display auto-stake destinations for the supplied wallet."""
3433

bittensor_cli/src/commands/stake/move.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ def prompt_stake_amount(
201201
return Balance.from_tao(amount), False
202202
except ValueError:
203203
console.print("[red]Please enter a valid number or 'all'[/red]")
204+
# can never return this, but fixes the type checker
205+
return Balance(0), False
204206

205207

206208
async def stake_move_transfer_selection(
@@ -818,14 +820,16 @@ async def swap_stake(
818820
wait_for_finalization (bool): If true, waits for the transaction to be finalized.
819821
820822
Returns:
821-
bool: True if the swap was successful, False otherwise.
823+
(success, extrinsic_identifier):
824+
success is True if the swap was successful, False otherwise.
825+
extrinsic_identifier if the extrinsic was successfully included
822826
"""
823827
hotkey_ss58 = get_hotkey_pub_ss58(wallet)
824828
if interactive_selection:
825829
try:
826830
selection = await stake_swap_selection(subtensor, wallet)
827831
except ValueError:
828-
return False
832+
return False, ""
829833
origin_netuid = selection["origin_netuid"]
830834
amount = selection["amount"]
831835
destination_netuid = selection["destination_netuid"]

bittensor_cli/src/commands/stake/remove.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ async def unstake_all(
370370
era: int = 3,
371371
prompt: bool = True,
372372
json_output: bool = False,
373-
) -> bool:
373+
) -> None:
374374
"""Unstakes all stakes from all hotkeys in all subnets."""
375375
include_hotkeys = include_hotkeys or []
376376
exclude_hotkeys = exclude_hotkeys or []
@@ -419,7 +419,7 @@ async def unstake_all(
419419

420420
if not stake_info:
421421
console.print("[red]No stakes found to unstake[/red]")
422-
return False
422+
return
423423

424424
all_sn_dynamic_info = {info.netuid: info for info in all_sn_dynamic_info_}
425425

@@ -531,10 +531,10 @@ async def unstake_all(
531531
if prompt and not Confirm.ask(
532532
"\nDo you want to proceed with unstaking everything?"
533533
):
534-
return False
534+
return
535535

536536
if not unlock_key(wallet).success:
537-
return False
537+
return
538538
successes = {}
539539
with console.status("Unstaking all stakes...") as status:
540540
for hotkey_ss58 in hotkey_ss58s:
@@ -553,7 +553,7 @@ async def unstake_all(
553553
"extrinsic_identifier": ext_id,
554554
}
555555
if json_output:
556-
return json_console.print(json.dumps({"success": successes}))
556+
json_console.print(json.dumps({"success": successes}))
557557

558558

559559
# Extrinsics

0 commit comments

Comments
 (0)