From 1314e1b8ac0e1a20d2a87816ca516792e065c5b1 Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Wed, 12 Feb 2025 23:58:20 -0800 Subject: [PATCH 1/5] Fixes stake amount prompt --- bittensor_cli/cli.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/bittensor_cli/cli.py b/bittensor_cli/cli.py index 3ac1ffe2a..5c09924ab 100755 --- a/bittensor_cli/cli.py +++ b/bittensor_cli/cli.py @@ -2881,9 +2881,6 @@ def stake_add( ) raise typer.Exit() - if not stake_all and not amount: - amount = FloatPrompt.ask("Amount to [blue]stake (TAO τ)[/blue]") - if stake_all and not amount: if not Confirm.ask("Stake all the available TAO tokens?", default=False): raise typer.Exit() From 0999b1f36e3866d2c0a36f21c1e5618cd8eea9bf Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Thu, 13 Feb 2025 16:30:35 +0200 Subject: [PATCH 2/5] Tidying. --- .../src/bittensor/extrinsics/registration.py | 2 +- bittensor_cli/src/bittensor/utils.py | 1 - bittensor_cli/src/commands/subnets/subnets.py | 2 +- bittensor_cli/src/commands/sudo.py | 16 ++++++++-------- bittensor_cli/src/commands/wallets.py | 2 +- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/bittensor_cli/src/bittensor/extrinsics/registration.py b/bittensor_cli/src/bittensor/extrinsics/registration.py index 7c747ad8b..65d8f348d 100644 --- a/bittensor_cli/src/bittensor/extrinsics/registration.py +++ b/bittensor_cli/src/bittensor/extrinsics/registration.py @@ -693,7 +693,7 @@ async def burned_register_extrinsic( :return: Flag is `True` if extrinsic was finalized or included in the block. If we did not wait for finalization/inclusion, the response is `True`. """ - + if not (unlock_status := unlock_key(wallet, print_out=False)).success: return False, unlock_status.message diff --git a/bittensor_cli/src/bittensor/utils.py b/bittensor_cli/src/bittensor/utils.py index cbd27de60..2ac4019e8 100644 --- a/bittensor_cli/src/bittensor/utils.py +++ b/bittensor_cli/src/bittensor/utils.py @@ -32,7 +32,6 @@ if TYPE_CHECKING: from bittensor_cli.src.bittensor.chain_data import SubnetHyperparameters - from async_substrate_interface.async_substrate import AsyncSubstrateInterface console = Console() err_console = Console(stderr=True) diff --git a/bittensor_cli/src/commands/subnets/subnets.py b/bittensor_cli/src/commands/subnets/subnets.py index 44eea5e57..141dfb62f 100644 --- a/bittensor_cli/src/commands/subnets/subnets.py +++ b/bittensor_cli/src/commands/subnets/subnets.py @@ -1322,7 +1322,7 @@ async def show_subnet(netuid_: int): return hotkey else: console.print( - f"[red]Invalid UID. Please enter a valid UID from the table above[/red]" + "[red]Invalid UID. Please enter a valid UID from the table above[/red]" ) except ValueError: console.print("[red]Please enter a valid number[/red]") diff --git a/bittensor_cli/src/commands/sudo.py b/bittensor_cli/src/commands/sudo.py index bf850b401..2285a0bd8 100644 --- a/bittensor_cli/src/commands/sudo.py +++ b/bittensor_cli/src/commands/sudo.py @@ -657,10 +657,10 @@ async def senate_vote( return False # Unlock the wallet. - try: - wallet.unlock_hotkey() - wallet.unlock_coldkey() - except KeyFileError: + if ( + not unlock_key(wallet, "hotkey").success + and unlock_key(wallet, "coldkey").success + ): return False console.print(f"Fetching proposals in [dark_orange]network: {subtensor.network}") @@ -736,10 +736,10 @@ async def _do_set_take() -> bool: f"Setting take on [{COLOR_PALETTE['GENERAL']['LINKS']}]network: {subtensor.network}" ) - try: - wallet.unlock_hotkey() - wallet.unlock_coldkey() - except KeyFileError: + if ( + not unlock_key(wallet, "hotkey").success + and unlock_key(wallet, "coldkey").success + ): return False result_ = await _do_set_take() diff --git a/bittensor_cli/src/commands/wallets.py b/bittensor_cli/src/commands/wallets.py index 4af28d4ea..e3a3e8d64 100644 --- a/bittensor_cli/src/commands/wallets.py +++ b/bittensor_cli/src/commands/wallets.py @@ -6,7 +6,7 @@ import aiohttp from bittensor_wallet import Wallet, Keypair -from bittensor_wallet.errors import KeyFileError, PasswordError +from bittensor_wallet.errors import KeyFileError from bittensor_wallet.keyfile import Keyfile from fuzzywuzzy import fuzz from rich import box From 2c2e690590ec1d5088f74fd9442e3627f9e76271 Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Thu, 13 Feb 2025 09:21:05 -0800 Subject: [PATCH 3/5] Fix dupe -p flag --- bittensor_cli/cli.py | 1 - 1 file changed, 1 deletion(-) diff --git a/bittensor_cli/cli.py b/bittensor_cli/cli.py index 5c09924ab..cd3356f2f 100755 --- a/bittensor_cli/cli.py +++ b/bittensor_cli/cli.py @@ -3744,7 +3744,6 @@ def stake_set_children( [], "--proportions", "--prop", - "-p", help="Enter the stake weight proportions for the child hotkeys (sum should be less than or equal to 1)", prompt=False, ), From da94e97c1ee057b4643c22815633d5b0044f01c3 Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Thu, 13 Feb 2025 09:28:08 -0800 Subject: [PATCH 4/5] Updates tao_weight for mainnet --- bittensor_cli/src/commands/subnets/subnets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bittensor_cli/src/commands/subnets/subnets.py b/bittensor_cli/src/commands/subnets/subnets.py index 141dfb62f..4f116e626 100644 --- a/bittensor_cli/src/commands/subnets/subnets.py +++ b/bittensor_cli/src/commands/subnets/subnets.py @@ -40,7 +40,7 @@ if TYPE_CHECKING: from bittensor_cli.src.bittensor.subtensor_interface import SubtensorInterface -TAO_WEIGHT = 0.018 +TAO_WEIGHT = 0.18 # helpers and extrinsics From 380f0a0fd69b1902a9c7b3dafe38edbeaadcbf35 Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Thu, 13 Feb 2025 09:56:37 -0800 Subject: [PATCH 5/5] fix unlocking in sudo --- bittensor_cli/src/commands/sudo.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bittensor_cli/src/commands/sudo.py b/bittensor_cli/src/commands/sudo.py index 2285a0bd8..58c6a4b15 100644 --- a/bittensor_cli/src/commands/sudo.py +++ b/bittensor_cli/src/commands/sudo.py @@ -658,8 +658,8 @@ async def senate_vote( # Unlock the wallet. if ( - not unlock_key(wallet, "hotkey").success - and unlock_key(wallet, "coldkey").success + not unlock_key(wallet, "hot").success + and unlock_key(wallet, "cold").success ): return False @@ -737,8 +737,8 @@ async def _do_set_take() -> bool: ) if ( - not unlock_key(wallet, "hotkey").success - and unlock_key(wallet, "coldkey").success + not unlock_key(wallet, "hot").success + and unlock_key(wallet, "cold").success ): return False