From 8f2d3a87ebbbdbbf19f57fb0eef4876f2e215a59 Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Fri, 21 Feb 2025 18:15:59 +0200 Subject: [PATCH 01/13] Update wording for burn cost for sn registration --- bittensor_cli/cli.py | 2 -- bittensor_cli/src/commands/subnets/subnets.py | 8 +++++--- bittensor_cli/version.py | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bittensor_cli/cli.py b/bittensor_cli/cli.py index 2c5b70992..419fd8c32 100755 --- a/bittensor_cli/cli.py +++ b/bittensor_cli/cli.py @@ -74,8 +74,6 @@ class GitError(Exception): pass - - _epilog = "Made with [bold red]:heart:[/bold red] by The Openτensor Foundaτion" np.set_printoptions(precision=8, suppress=True, floatmode="fixed") diff --git a/bittensor_cli/src/commands/subnets/subnets.py b/bittensor_cli/src/commands/subnets/subnets.py index f4e01486c..568913fe9 100644 --- a/bittensor_cli/src/commands/subnets/subnets.py +++ b/bittensor_cli/src/commands/subnets/subnets.py @@ -97,8 +97,10 @@ async def _find_event_attributes_in_extrinsic_receipt( sn_burn_cost = await burn_cost(subtensor) if sn_burn_cost > your_balance: err_console.print( - f"Your balance of: [{COLOR_PALETTE['POOLS']['TAO']}]{your_balance}[{COLOR_PALETTE['POOLS']['TAO']}] is not enough to pay the subnet lock cost of: " - f"[{COLOR_PALETTE['POOLS']['TAO']}]{sn_burn_cost}[{COLOR_PALETTE['POOLS']['TAO']}]" + f"Your balance of: [{COLOR_PALETTE['POOLS']['TAO']}]{your_balance}[{COLOR_PALETTE['POOLS']['TAO']}]" + f" is not enough to burn " + f"[{COLOR_PALETTE['POOLS']['TAO']}]{sn_burn_cost}[{COLOR_PALETTE['POOLS']['TAO']}] " + f"to register a subnet." ) return False @@ -107,7 +109,7 @@ async def _find_event_attributes_in_extrinsic_receipt( f"Your balance is: [{COLOR_PALETTE['POOLS']['TAO']}]{your_balance}" ) if not Confirm.ask( - f"Do you want to register a subnet for [{COLOR_PALETTE['POOLS']['TAO']}]{sn_burn_cost}?" + f"Do you want to burn [{COLOR_PALETTE['POOLS']['TAO']}]{sn_burn_cost} to register a subnet?" ): return False diff --git a/bittensor_cli/version.py b/bittensor_cli/version.py index b47664c90..2daeadf01 100644 --- a/bittensor_cli/version.py +++ b/bittensor_cli/version.py @@ -1,5 +1,6 @@ import re + def version_as_int(version): _core_version = re.match(r"^\d+\.\d+\.\d+", version).group(0) _version_split = _core_version.split(".") @@ -14,5 +15,6 @@ def version_as_int(version): __new_signature_version__ = 360 return __version_as_int__ + __version__ = "9.0.0" __version_as_int__ = version_as_int(__version__) From 976742f8da6245a281ae53c911036a2927e4fff2 Mon Sep 17 00:00:00 2001 From: Cameron Fairchild Date: Fri, 21 Feb 2025 20:32:40 -0500 Subject: [PATCH 02/13] use chk_take = 0 if None --- bittensor_cli/src/commands/stake/children_hotkeys.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bittensor_cli/src/commands/stake/children_hotkeys.py b/bittensor_cli/src/commands/stake/children_hotkeys.py index ef50a5232..89b5ade4f 100644 --- a/bittensor_cli/src/commands/stake/children_hotkeys.py +++ b/bittensor_cli/src/commands/stake/children_hotkeys.py @@ -671,6 +671,8 @@ async def display_chk_take(ss58, netuid): chk_take = await get_childkey_take( subtensor=subtensor, netuid=netuid, hotkey=ss58 ) + if chk_take is None: + chk_take = 0 chk_take = u16_to_float(chk_take) console.print( f"Child take for {ss58} is: {chk_take * 100:.2f}% on netuid {netuid}." From d0011f9a5ac0b3d11c1d5ff255ade6e9ea0ff5e2 Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Mon, 24 Feb 2025 16:09:29 +0200 Subject: [PATCH 03/13] Use `unlock_key` function. --- bittensor_cli/cli.py | 2 -- bittensor_cli/src/commands/stake/add.py | 6 ++---- bittensor_cli/src/commands/stake/move.py | 16 ++++------------ bittensor_cli/src/commands/stake/remove.py | 11 +++-------- bittensor_cli/src/commands/subnets/subnets.py | 5 +---- bittensor_cli/version.py | 2 ++ 6 files changed, 12 insertions(+), 30 deletions(-) diff --git a/bittensor_cli/cli.py b/bittensor_cli/cli.py index 2c5b70992..419fd8c32 100755 --- a/bittensor_cli/cli.py +++ b/bittensor_cli/cli.py @@ -74,8 +74,6 @@ class GitError(Exception): pass - - _epilog = "Made with [bold red]:heart:[/bold red] by The Openτensor Foundaτion" np.set_printoptions(precision=8, suppress=True, floatmode="fixed") diff --git a/bittensor_cli/src/commands/stake/add.py b/bittensor_cli/src/commands/stake/add.py index 4aba39e69..2950da876 100644 --- a/bittensor_cli/src/commands/stake/add.py +++ b/bittensor_cli/src/commands/stake/add.py @@ -17,6 +17,7 @@ is_valid_ss58_address, print_error, print_verbose, + unlock_key, ) from bittensor_wallet import Wallet from bittensor_wallet.errors import KeyFileError @@ -338,10 +339,7 @@ async def stake_extrinsic( if prompt: if not Confirm.ask("Would you like to continue?"): raise typer.Exit() - try: - wallet.unlock_coldkey() - except KeyFileError: - err_console.print("Error decrypting coldkey (possibly incorrect password)") + if not unlock_key(wallet).success: return False if safe_staking: diff --git a/bittensor_cli/src/commands/stake/move.py b/bittensor_cli/src/commands/stake/move.py index 964f0ed1b..876f500e6 100644 --- a/bittensor_cli/src/commands/stake/move.py +++ b/bittensor_cli/src/commands/stake/move.py @@ -17,6 +17,7 @@ format_error_message, group_subnets, get_subnet_name, + unlock_key, ) if TYPE_CHECKING: @@ -621,10 +622,7 @@ async def move_stake( raise typer.Exit() # Perform moving operation. - try: - wallet.unlock_coldkey() - except KeyFileError: - err_console.print("Error decrypting coldkey (possibly incorrect password)") + if not unlock_key(wallet).success: return False with console.status( f"\n:satellite: Moving [blue]{amount_to_move_as_balance}[/blue] from [blue]{origin_hotkey}[/blue] on netuid: [blue]{origin_netuid}[/blue] \nto " @@ -777,10 +775,7 @@ async def transfer_stake( raise typer.Exit() # Perform transfer operation - try: - wallet.unlock_coldkey() - except KeyFileError: - err_console.print("Error decrypting coldkey (possibly incorrect password)") + if not unlock_key(wallet).success: return False with console.status("\n:satellite: Transferring stake ..."): @@ -933,10 +928,7 @@ async def swap_stake( raise typer.Exit() # Perform swap operation - try: - wallet.unlock_coldkey() - except KeyFileError: - err_console.print("Error decrypting coldkey (possibly incorrect password)") + if not unlock_key(wallet).success: return False with console.status( diff --git a/bittensor_cli/src/commands/stake/remove.py b/bittensor_cli/src/commands/stake/remove.py index 048855fdc..fc298de47 100644 --- a/bittensor_cli/src/commands/stake/remove.py +++ b/bittensor_cli/src/commands/stake/remove.py @@ -21,6 +21,7 @@ is_valid_ss58_address, format_error_message, group_subnets, + unlock_key, ) if TYPE_CHECKING: @@ -268,10 +269,7 @@ async def unstake( raise typer.Exit() # Execute extrinsics - try: - wallet.unlock_coldkey() - except KeyFileError: - err_console.print("Error decrypting coldkey (possibly incorrect password)") + if not unlock_key(wallet).success: return False with console.status("\n:satellite: Performing unstaking operations...") as status: @@ -465,10 +463,7 @@ async def unstake_all( ): return False - try: - wallet.unlock_coldkey() - except KeyFileError: - err_console.print("Error decrypting coldkey (possibly incorrect password)") + if not unlock_key(wallet).success: return False with console.status("Unstaking all stakes...") as status: diff --git a/bittensor_cli/src/commands/subnets/subnets.py b/bittensor_cli/src/commands/subnets/subnets.py index f4e01486c..b419d81de 100644 --- a/bittensor_cli/src/commands/subnets/subnets.py +++ b/bittensor_cli/src/commands/subnets/subnets.py @@ -145,10 +145,7 @@ async def _find_event_attributes_in_extrinsic_receipt( ) return False - try: - wallet.unlock_coldkey() - except KeyFileError: - err_console.print("Error decrypting coldkey (possibly incorrect password)") + if not unlock_key(wallet).success: return False with console.status(":satellite: Registering subnet...", spinner="earth"): diff --git a/bittensor_cli/version.py b/bittensor_cli/version.py index b47664c90..2daeadf01 100644 --- a/bittensor_cli/version.py +++ b/bittensor_cli/version.py @@ -1,5 +1,6 @@ import re + def version_as_int(version): _core_version = re.match(r"^\d+\.\d+\.\d+", version).group(0) _version_split = _core_version.split(".") @@ -14,5 +15,6 @@ def version_as_int(version): __new_signature_version__ = 360 return __version_as_int__ + __version__ = "9.0.0" __version_as_int__ = version_as_int(__version__) From b675ca5fc6bd94213db1c4a837507d738606bc5d Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Tue, 25 Feb 2025 17:55:08 +0200 Subject: [PATCH 04/13] Warn users about root-only hyperparams --- bittensor_cli/src/commands/sudo.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bittensor_cli/src/commands/sudo.py b/bittensor_cli/src/commands/sudo.py index 78106ae31..9e9098f53 100644 --- a/bittensor_cli/src/commands/sudo.py +++ b/bittensor_cli/src/commands/sudo.py @@ -189,6 +189,11 @@ async def set_hyperparameter_extrinsic( ":cross_mark: [red]Invalid hyperparameter specified.[/red]" ) return False + if sudo_: + if not Confirm.ask( + "This hyperparam is only settable by root sudo users. If you are not, this will fail. Please confirm" + ): + return False substrate = subtensor.substrate msg_value = value if not arbitrary_extrinsic else call_params From fc4540c1055d5d714fb5b7ee2290e071e7904710 Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Tue, 25 Feb 2025 18:14:12 +0200 Subject: [PATCH 05/13] Adds `origin_hotkey` for `transfer_stake` to allow users to specify the SS58 rather than requiring the hotkey to be in the wallet. --- bittensor_cli/cli.py | 42 +++++++++++++++++++----- bittensor_cli/src/commands/stake/move.py | 17 +++++----- 2 files changed, 43 insertions(+), 16 deletions(-) diff --git a/bittensor_cli/cli.py b/bittensor_cli/cli.py index 419fd8c32..e0a9d9a15 100755 --- a/bittensor_cli/cli.py +++ b/bittensor_cli/cli.py @@ -3321,9 +3321,9 @@ def stake_remove( def stake_move( self, network: Optional[list[str]] = Options.network, - wallet_name=Options.wallet_name, - wallet_path=Options.wallet_path, - wallet_hotkey=Options.wallet_hotkey, + wallet_name: Optional[str] = Options.wallet_name, + wallet_path: Optional[str] = Options.wallet_path, + wallet_hotkey: Optional[str] = Options.wallet_hotkey, origin_netuid: Optional[int] = typer.Option( None, "--origin-netuid", help="Origin netuid" ), @@ -3534,13 +3534,38 @@ def stake_transfer( self.verbosity_handler(quiet, verbose) wallet = self.wallet_ask( - wallet_name, - wallet_path, - wallet_hotkey, - ask_for=[WO.NAME, WO.PATH, WO.HOTKEY], - validate=WV.WALLET_AND_HOTKEY, + wallet_name, wallet_path, wallet_hotkey, ask_for=[WO.NAME, WO.PATH] ) + if not wallet_hotkey: + origin_hotkey = Prompt.ask( + "Enter the [blue]origin hotkey[/blue] name or " + "[blue]ss58 address[/blue] where the stake will be moved from " + ) + if is_valid_ss58_address(origin_hotkey): + origin_hotkey = origin_hotkey + else: + wallet = self.wallet_ask( + wallet_name, + wallet_path, + origin_hotkey, + ask_for=[WO.NAME, WO.PATH, WO.HOTKEY], + validate=WV.WALLET_AND_HOTKEY, + ) + origin_hotkey = wallet.hotkey.ss58_address + else: + if is_valid_ss58_address(wallet_hotkey): + origin_hotkey = wallet_hotkey + else: + wallet = self.wallet_ask( + wallet_name, + wallet_path, + wallet_hotkey, + ask_for=[], + validate=WV.WALLET_AND_HOTKEY, + ) + origin_hotkey = wallet.hotkey.ss58_address + if not dest_ss58: dest_ss58 = Prompt.ask( "Enter the [blue]destination wallet name[/blue] or [blue]coldkey SS58 address[/blue]" @@ -3578,6 +3603,7 @@ def stake_transfer( move_stake.transfer_stake( wallet=wallet, subtensor=self.initialize_chain(network), + origin_hotkey=origin_hotkey, origin_netuid=origin_netuid, dest_netuid=dest_netuid, dest_coldkey_ss58=dest_ss58, diff --git a/bittensor_cli/src/commands/stake/move.py b/bittensor_cli/src/commands/stake/move.py index 964f0ed1b..d8b6360e6 100644 --- a/bittensor_cli/src/commands/stake/move.py +++ b/bittensor_cli/src/commands/stake/move.py @@ -697,6 +697,7 @@ async def transfer_stake( wallet: Wallet, subtensor: "SubtensorInterface", amount: float, + origin_hotkey: str, origin_netuid: int, dest_netuid: int, dest_coldkey_ss58: str, @@ -709,6 +710,7 @@ async def transfer_stake( wallet (Wallet): Bittensor wallet object. subtensor (SubtensorInterface): Subtensor interface instance. amount (float): Amount to transfer. + origin_hotkey (str): The hotkey SS58 to transfer the stake from. origin_netuid (int): The netuid to transfer stake from. dest_netuid (int): The netuid to transfer stake to. dest_coldkey_ss58 (str): The destination coldkey to transfer stake to. @@ -739,16 +741,15 @@ async def transfer_stake( return False # Get current stake balances - hotkey_ss58 = wallet.hotkey.ss58_address with console.status(f"Retrieving stake data from {subtensor.network}..."): current_stake = await subtensor.get_stake( coldkey_ss58=wallet.coldkeypub.ss58_address, - hotkey_ss58=hotkey_ss58, + hotkey_ss58=origin_hotkey, netuid=origin_netuid, ) current_dest_stake = await subtensor.get_stake( coldkey_ss58=dest_coldkey_ss58, - hotkey_ss58=hotkey_ss58, + hotkey_ss58=origin_hotkey, netuid=dest_netuid, ) amount_to_transfer = Balance.from_tao(amount).set_unit(origin_netuid) @@ -768,8 +769,8 @@ async def transfer_stake( subtensor=subtensor, origin_netuid=origin_netuid, destination_netuid=dest_netuid, - origin_hotkey=hotkey_ss58, - destination_hotkey=hotkey_ss58, + origin_hotkey=origin_hotkey, + destination_hotkey=origin_hotkey, amount_to_move=amount_to_transfer, ) @@ -789,7 +790,7 @@ async def transfer_stake( call_function="transfer_stake", call_params={ "destination_coldkey": dest_coldkey_ss58, - "hotkey": hotkey_ss58, + "hotkey": origin_hotkey, "origin_netuid": origin_netuid, "destination_netuid": dest_netuid, "alpha_amount": amount_to_transfer.rao, @@ -820,12 +821,12 @@ async def transfer_stake( new_stake, new_dest_stake = await asyncio.gather( subtensor.get_stake( coldkey_ss58=wallet.coldkeypub.ss58_address, - hotkey_ss58=hotkey_ss58, + hotkey_ss58=origin_hotkey, netuid=origin_netuid, ), subtensor.get_stake( coldkey_ss58=dest_coldkey_ss58, - hotkey_ss58=hotkey_ss58, + hotkey_ss58=origin_hotkey, netuid=dest_netuid, ), ) From 8c7077165f23085b9226979710126c94d5619847 Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Tue, 25 Feb 2025 09:47:35 -0800 Subject: [PATCH 06/13] Edge case: avoid 2 prompts for wallet --- bittensor_cli/cli.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bittensor_cli/cli.py b/bittensor_cli/cli.py index e0a9d9a15..39f105757 100755 --- a/bittensor_cli/cli.py +++ b/bittensor_cli/cli.py @@ -3533,14 +3533,20 @@ def stake_transfer( ) self.verbosity_handler(quiet, verbose) + if not wallet_name: + wallet_name = Prompt.ask( + "Enter the [blue]origin wallet name[/blue]", + default=self.config.get("wallet_name") or defaults.wallet.name, + ) wallet = self.wallet_ask( - wallet_name, wallet_path, wallet_hotkey, ask_for=[WO.NAME, WO.PATH] + wallet_name, wallet_path, wallet_hotkey, ask_for=[WO.NAME] ) if not wallet_hotkey: origin_hotkey = Prompt.ask( "Enter the [blue]origin hotkey[/blue] name or " - "[blue]ss58 address[/blue] where the stake will be moved from " + "[blue]ss58 address[/blue] where the stake will be moved from", + default=self.config.get("wallet_hotkey") or defaults.wallet.hotkey, ) if is_valid_ss58_address(origin_hotkey): origin_hotkey = origin_hotkey From 7c8ebe52d2f62bd3bd5677ebf630b13314932454 Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Tue, 25 Feb 2025 12:03:11 -0800 Subject: [PATCH 07/13] testing --- .github/workflows/e2e-subtensor-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/e2e-subtensor-tests.yml b/.github/workflows/e2e-subtensor-tests.yml index 1c6251802..356b2d7f7 100644 --- a/.github/workflows/e2e-subtensor-tests.yml +++ b/.github/workflows/e2e-subtensor-tests.yml @@ -50,6 +50,7 @@ jobs: toolchain: ${{ env.RUSTV }} components: rustfmt profile: minimal + override: true - name: Add wasm32-unknown-unknown target run: | From e8b5cfa80b37b1f0e02ca992ff2c676030ce02da Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Tue, 25 Feb 2025 12:25:33 -0800 Subject: [PATCH 08/13] testing --- .github/workflows/e2e-subtensor-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e-subtensor-tests.yml b/.github/workflows/e2e-subtensor-tests.yml index 356b2d7f7..fee73a7c5 100644 --- a/.github/workflows/e2e-subtensor-tests.yml +++ b/.github/workflows/e2e-subtensor-tests.yml @@ -54,8 +54,8 @@ jobs: - name: Add wasm32-unknown-unknown target run: | - rustup target add wasm32-unknown-unknown --toolchain stable-x86_64-unknown-linux-gnu - rustup component add rust-src --toolchain stable-x86_64-unknown-linux-gnu + rustup target add wasm32-unknown-unknown --toolchain nightly-2024-03-05 + rustup component add rust-src --toolchain nightly-2024-03-05 - name: Clone subtensor repo run: git clone https://github.com/opentensor/subtensor.git From 322e8913e01c8fad60ff3c159a8e823737f8ba2b Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Tue, 25 Feb 2025 12:39:02 -0800 Subject: [PATCH 09/13] testing --- .github/workflows/e2e-subtensor-tests.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e2e-subtensor-tests.yml b/.github/workflows/e2e-subtensor-tests.yml index fee73a7c5..d66eadbee 100644 --- a/.github/workflows/e2e-subtensor-tests.yml +++ b/.github/workflows/e2e-subtensor-tests.yml @@ -30,7 +30,7 @@ jobs: timeout-minutes: 180 env: RELEASE_NAME: development - RUSTV: nightly-2024-03-05 + RUSTV: stable RUST_BACKTRACE: full RUST_BIN_DIR: target/x86_64-unknown-linux-gnu TARGET: x86_64-unknown-linux-gnu @@ -50,12 +50,11 @@ jobs: toolchain: ${{ env.RUSTV }} components: rustfmt profile: minimal - override: true - name: Add wasm32-unknown-unknown target run: | - rustup target add wasm32-unknown-unknown --toolchain nightly-2024-03-05 - rustup component add rust-src --toolchain nightly-2024-03-05 + rustup target add wasm32-unknown-unknown --toolchain stable-x86_64-unknown-linux-gnu + rustup component add rust-src --toolchain stable-x86_64-unknown-linux-gnu - name: Clone subtensor repo run: git clone https://github.com/opentensor/subtensor.git From a892cb40ca729fbda7ba3156a73c8e18f69c0a81 Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Wed, 26 Feb 2025 09:55:36 -0800 Subject: [PATCH 10/13] Adds limit of ss58s per call --- .../src/bittensor/subtensor_interface.py | 35 ++++++++++++------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/bittensor_cli/src/bittensor/subtensor_interface.py b/bittensor_cli/src/bittensor/subtensor_interface.py index 65474b324..c72d3d809 100644 --- a/bittensor_cli/src/bittensor/subtensor_interface.py +++ b/bittensor_cli/src/bittensor/subtensor_interface.py @@ -1327,20 +1327,29 @@ async def get_stake_for_coldkeys( This function is useful for analyzing the stake distribution and delegation patterns of multiple accounts simultaneously, offering a broader perspective on network participation and investment strategies. """ - result = await self.query_runtime_api( - runtime_api="StakeInfoRuntimeApi", - method="get_stake_info_for_coldkeys", - params=[coldkey_ss58_list], - block_hash=block_hash, - ) - if result is None: - return None - + BATCH_SIZE = 60 + + tasks = [] + for i in range(0, len(coldkey_ss58_list), BATCH_SIZE): + ss58_chunk = coldkey_ss58_list[i : i + BATCH_SIZE] + tasks.append( + self.query_runtime_api( + runtime_api="StakeInfoRuntimeApi", + method="get_stake_info_for_coldkeys", + params=[ss58_chunk], + block_hash=block_hash, + ) + ) + results = await asyncio.gather(*tasks) stake_info_map = {} - for coldkey_bytes, stake_info_list in result: - coldkey_ss58 = decode_account_id(coldkey_bytes) - stake_info_map[coldkey_ss58] = StakeInfo.list_from_any(stake_info_list) - return stake_info_map + for result in results: + if result is None: + continue + for coldkey_bytes, stake_info_list in result: + coldkey_ss58 = decode_account_id(coldkey_bytes) + stake_info_map[coldkey_ss58] = StakeInfo.list_from_any(stake_info_list) + + return stake_info_map if stake_info_map else None async def all_subnets(self, block_hash: Optional[str] = None) -> list[DynamicInfo]: result = await self.query_runtime_api( From 708eb4282a7b2b9fe10f4149143a22c3df5e87b2 Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Wed, 26 Feb 2025 21:56:11 +0200 Subject: [PATCH 11/13] We regressed due to setting `Repo = None`. This ensures you're able to use `btcli --version` if git is not installed. --- bittensor_cli/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bittensor_cli/cli.py b/bittensor_cli/cli.py index 39f105757..10814682c 100755 --- a/bittensor_cli/cli.py +++ b/bittensor_cli/cli.py @@ -479,7 +479,7 @@ def version_callback(value: bool): f"{repo.active_branch.name}/" f"{repo.commit()}" ) - except (NameError, GitError): + except (TypeError, GitError): version = f"BTCLI version: {__version__}" typer.echo(version) raise typer.Exit() From 76ee6154e4118bb20aaa0f6f7758170db333afc3 Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Wed, 26 Feb 2025 13:00:24 -0800 Subject: [PATCH 12/13] Adds e2e test --- tests/e2e_tests/test_wallet_creations.py | 57 ++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/tests/e2e_tests/test_wallet_creations.py b/tests/e2e_tests/test_wallet_creations.py index 52aa31399..ac82ec2a4 100644 --- a/tests/e2e_tests/test_wallet_creations.py +++ b/tests/e2e_tests/test_wallet_creations.py @@ -461,3 +461,60 @@ def test_wallet_regen(wallet_setup, capfd): initial_hotkey_mod_time != new_hotkey_mod_time ), "Hotkey file was not regenerated as expected" print("Passed wallet regen_hotkey command ✅") + + +def test_wallet_balance_all(local_chain, wallet_setup, capfd): + """ + Test the wallet balance --all command with a large number of wallets. + + Steps: + 1. Create 100 wallets + 2. Run wallet balance --all command + 3. Verify the output contains all wallet names and their balances + + Raises: + AssertionError: If any of the checks or verifications fail + """ + wallet_path_name = "//Alice" + keypair, wallet, wallet_path, exec_command = wallet_setup(wallet_path_name) + + print("Creating 100 wallets for testing balance --all command 🧪") + num_wallets = 100 + wallet_names = [] + + for i in range(num_wallets): + wallet_name = f"test_wallet_{i}" + wallet_names.append(wallet_name) + + result = exec_command( + command="wallet", + sub_command="new-coldkey", + extra_args=[ + "--wallet-name", + wallet_name, + "--wallet-path", + wallet_path, + "--n-words", + "12", + "--no-use-password", + ], + ) + + wallet_status, message = verify_wallet_dir(wallet_path, wallet_name) + assert wallet_status, message + + print("Testing wallet balance --all command 🧪") + result = exec_command( + command="wallet", + sub_command="balance", + extra_args=["--wallet-path", wallet_path, "--all"], + ) + + output = result.stdout + + for wallet_name in wallet_names: + assert ( + wallet_name in output + ), f"Wallet {wallet_name} not found in balance --all output" + + print("Passed wallet balance --all command with 100 wallets ✅") From 9340202f14504e30822166ad205fa337c2b0e268 Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Wed, 26 Feb 2025 16:00:28 -0800 Subject: [PATCH 13/13] Bumps version and changelog --- CHANGELOG.md | 15 +++++++++++++++ bittensor_cli/version.py | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed6f82e67..02ce58743 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 9.0.3 /2025-02-26 + +## What's Changed +* Update wording for burn for sn registration by @thewhaleking in https://github.com/opentensor/btcli/pull/333 +* [fix] use chk_take = 0 if None by @camfairchild in https://github.com/opentensor/btcli/pull/335 +* Use `unlock_key` fn globally by @thewhaleking in https://github.com/opentensor/btcli/pull/336 +* Updates Rust version to stable by @ibraheem-opentensor in https://github.com/opentensor/btcli/pull/339 +* Warn Users When Setting Root-Only Hyperparams by @thewhaleking in https://github.com/opentensor/btcli/pull/337 +* st transfer allow hotkey ss58 by @thewhaleking in https://github.com/opentensor/btcli/pull/338 +* Git not required by @thewhaleking in https://github.com/opentensor/btcli/pull/341 +* Adds limit of ss58 addresses per call when fetching total_stake by @ibraheem-opentensor in https://github.com/opentensor/btcli/pull/340 +* Backmerge/main staging 902 by @ibraheem-opentensor in https://github.com/opentensor/btcli/pull/342 + +**Full Changelog**: https://github.com/opentensor/btcli/compare/v9.0.2...v9.0.3 + ## 9.0.2 /2025-02-20 ## What's Changed diff --git a/bittensor_cli/version.py b/bittensor_cli/version.py index bbebcaf23..b035a7bd5 100644 --- a/bittensor_cli/version.py +++ b/bittensor_cli/version.py @@ -15,5 +15,5 @@ def version_as_int(version): __new_signature_version__ = 360 return __version_as_int__ -__version__ = "9.0.2" +__version__ = "9.0.3" __version_as_int__ = version_as_int(__version__)