diff --git a/.github/workflows/e2e-subtensor-tests.yml b/.github/workflows/e2e-subtensor-tests.yml index 6b0db3f26..f57b9a1f7 100644 --- a/.github/workflows/e2e-subtensor-tests.yml +++ b/.github/workflows/e2e-subtensor-tests.yml @@ -73,7 +73,7 @@ jobs: os: - ubuntu-latest test-file: ${{ fromJson(needs.find-tests.outputs.test-files) }} - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] steps: - name: Check-out repository uses: actions/checkout@v4 diff --git a/bittensor_cli/cli.py b/bittensor_cli/cli.py index 3b6096047..7fae9e844 100755 --- a/bittensor_cli/cli.py +++ b/bittensor_cli/cli.py @@ -3326,7 +3326,7 @@ def wallet_set_id( network: Optional[list[str]] = Options.network, name: str = typer.Option( "", - "--name", + "--id-name", help="The display name for the identity.", ), web_url: str = typer.Option( @@ -6427,7 +6427,7 @@ def subnets_set_identity( network: Optional[list[str]] = Options.network, netuid: int = Options.netuid, subnet_name: Optional[str] = typer.Option( - None, "--subnet-name", "--name", help="Name of the subnet" + None, "--subnet-name", "--sn-name", help="Name of the subnet" ), github_repo: Optional[str] = typer.Option( None, "--github-repo", "--repo", help="GitHub repository URL" diff --git a/bittensor_cli/src/commands/liquidity/liquidity.py b/bittensor_cli/src/commands/liquidity/liquidity.py index 47f0141f3..a262e8874 100644 --- a/bittensor_cli/src/commands/liquidity/liquidity.py +++ b/bittensor_cli/src/commands/liquidity/liquidity.py @@ -342,6 +342,8 @@ async def get_liquidity_list( block_hash=block_hash, ), ) + if len(positions_response.records) == 0: + return False, "No liquidity positions found.", [] current_sqrt_price = fixed_to_float(current_sqrt_price) fee_global_tao = fixed_to_float(fee_global_tao) @@ -459,9 +461,21 @@ async def show_liquidity_list( netuid: int, json_output: bool = False, ) -> None: - current_price_, (success, err_msg, positions) = await asyncio.gather( - subtensor.subnet(netuid=netuid), get_liquidity_list(subtensor, wallet, netuid) + current_price_, liquidity_list_ = await asyncio.gather( + subtensor.subnet(netuid=netuid), + get_liquidity_list(subtensor, wallet, netuid), + return_exceptions=True, ) + if isinstance(current_price_, Exception): + success = False + err_msg = str(current_price_) + positions = [] + elif isinstance(liquidity_list_, Exception): + success = False + err_msg = str(liquidity_list_) + positions = [] + else: + (success, err_msg, positions) = liquidity_list_ if not success: if json_output: json_console.print( diff --git a/bittensor_cli/src/commands/stake/add.py b/bittensor_cli/src/commands/stake/add.py index 5b980af08..5046981da 100644 --- a/bittensor_cli/src/commands/stake/add.py +++ b/bittensor_cli/src/commands/stake/add.py @@ -481,9 +481,10 @@ async def stake_extrinsic( success, er_msg, ext_receipt = await coroutine successes[ni][staking_address] = success error_messages[ni][staking_address] = er_msg - extrinsic_ids[ni][ - staking_address - ] = await ext_receipt.get_extrinsic_identifier() + if success: + extrinsic_ids[ni][ + staking_address + ] = await ext_receipt.get_extrinsic_identifier() if json_output: json_console.print_json( data={ diff --git a/pyproject.toml b/pyproject.toml index c9a3e32b3..6c6f552f6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ authors = [ ] license = { file = "LICENSE" } scripts = { btcli = "bittensor_cli.cli:main" } -requires-python = ">=3.9,<3.14" +requires-python = ">=3.9,<3.15" dependencies = [ "wheel", "async-substrate-interface>=1.5.2", diff --git a/tests/e2e_tests/test_liquidity.py b/tests/e2e_tests/test_liquidity.py index faaf6e05e..7a210f0a1 100644 --- a/tests/e2e_tests/test_liquidity.py +++ b/tests/e2e_tests/test_liquidity.py @@ -1,6 +1,7 @@ import asyncio import json import re +import time from bittensor_cli.src.bittensor.balances import Balance from .utils import turn_off_hyperparam_freeze_window @@ -16,25 +17,6 @@ def test_liquidity(local_chain, wallet_setup): - def liquidity_list(): - return exec_command_alice( - command="liquidity", - sub_command="list", - extra_args=[ - "--wallet-path", - wallet_path_alice, - "--chain", - "ws://127.0.0.1:9945", - "--wallet-name", - wallet_alice.name, - "--wallet-hotkey", - wallet_alice.hotkey_str, - "--netuid", - netuid, - "--json-output", - ], - ) - wallet_path_alice = "//Alice" netuid = 2 @@ -48,6 +30,7 @@ def liquidity_list(): print( "Skipping turning off hyperparams freeze window. This indicates the call does not exist on the chain you are testing." ) + time.sleep(10) # Register a subnet with sudo as Alice result = exec_command_alice( @@ -88,7 +71,23 @@ def liquidity_list(): assert isinstance(result_output["extrinsic_identifier"], str) # verify no results for list thus far (subnet not yet started) - liquidity_list_result = liquidity_list() + liquidity_list_result = exec_command_alice( + command="liquidity", + sub_command="list", + extra_args=[ + "--wallet-path", + wallet_path_alice, + "--chain", + "ws://127.0.0.1:9945", + "--wallet-name", + wallet_alice.name, + "--wallet-hotkey", + wallet_alice.hotkey_str, + "--netuid", + netuid, + "--json-output", + ], + ) result_output = json.loads(liquidity_list_result.stdout) assert result_output["success"] is False assert f"Subnet with netuid: {netuid} is not active" in result_output["err_msg"] @@ -118,10 +117,51 @@ def liquidity_list(): ), start_subnet_emissions.stderr assert "Your extrinsic has been included " in start_subnet_emissions.stdout - liquidity_list_result = liquidity_list() + stake_to_enable_v3 = exec_command_alice( + command="stake", + sub_command="add", + extra_args=[ + "--netuid", + "2", + "--wallet-path", + wallet_path_alice, + "--wallet-name", + wallet_alice.name, + "--hotkey", + wallet_alice.hotkey_str, + "--chain", + "ws://127.0.0.1:9945", + "--amount", + "1", + "--unsafe", + "--no-prompt", + "--era", + "144", + ], + ) + assert "✅ Finalized" in stake_to_enable_v3.stdout, stake_to_enable_v3.stderr + time.sleep(10) + liquidity_list_result = exec_command_alice( + command="liquidity", + sub_command="list", + extra_args=[ + "--wallet-path", + wallet_path_alice, + "--chain", + "ws://127.0.0.1:9945", + "--wallet-name", + wallet_alice.name, + "--wallet-hotkey", + wallet_alice.hotkey_str, + "--netuid", + netuid, + "--json-output", + ], + ) + print(">>>", liquidity_list_result.stdout, liquidity_list_result.stderr) result_output = json.loads(liquidity_list_result.stdout) - assert result_output["success"] is True - assert result_output["err_msg"] == "" + assert result_output["success"] is False + assert result_output["err_msg"] == "No liquidity positions found." assert result_output["positions"] == [] enable_user_liquidity = exec_command_alice( @@ -179,13 +219,29 @@ def liquidity_list(): assert add_liquidity_result["message"] == "" assert isinstance(add_liquidity_result["extrinsic_identifier"], str) - liquidity_list_result = liquidity_list() + liquidity_list_result = exec_command_alice( + command="liquidity", + sub_command="list", + extra_args=[ + "--wallet-path", + wallet_path_alice, + "--chain", + "ws://127.0.0.1:9945", + "--wallet-name", + wallet_alice.name, + "--wallet-hotkey", + wallet_alice.hotkey_str, + "--netuid", + netuid, + "--json-output", + ], + ) + print(">>>", liquidity_list_result.stdout, liquidity_list_result.stderr) liquidity_list_result = json.loads(liquidity_list_result.stdout) assert liquidity_list_result["success"] is True assert len(liquidity_list_result["positions"]) == 1 liquidity_position = liquidity_list_result["positions"][0] assert liquidity_position["liquidity"] == 1.0 - assert liquidity_position["id"] == 2 assert liquidity_position["fees_tao"] == 0.0 assert liquidity_position["fees_alpha"] == 0.0 assert liquidity_position["netuid"] == netuid @@ -218,10 +274,27 @@ def liquidity_list(): assert modify_liquidity_result["success"] is True assert isinstance(modify_liquidity_result["extrinsic_identifier"], str) - liquidity_list_result = json.loads(liquidity_list().stdout) + llr = exec_command_alice( + command="liquidity", + sub_command="list", + extra_args=[ + "--wallet-path", + wallet_path_alice, + "--chain", + "ws://127.0.0.1:9945", + "--wallet-name", + wallet_alice.name, + "--wallet-hotkey", + wallet_alice.hotkey_str, + "--netuid", + netuid, + "--json-output", + ], + ) + print(">>>", llr.stdout, llr.stderr) + liquidity_list_result = json.loads(llr.stdout) assert len(liquidity_list_result["positions"]) == 1 liquidity_position = liquidity_list_result["positions"][0] - assert liquidity_position["id"] == 2 assert liquidity_position["liquidity"] == 21.0 removal = exec_command_alice( @@ -249,6 +322,25 @@ def liquidity_list(): removal_result[str(liquidity_position["id"])]["extrinsic_identifier"], str ) - liquidity_list_result = json.loads(liquidity_list().stdout) - assert liquidity_list_result["success"] is True + liquidity_list_result = exec_command_alice( + command="liquidity", + sub_command="list", + extra_args=[ + "--wallet-path", + wallet_path_alice, + "--chain", + "ws://127.0.0.1:9945", + "--wallet-name", + wallet_alice.name, + "--wallet-hotkey", + wallet_alice.hotkey_str, + "--netuid", + netuid, + "--json-output", + ], + ) + print(">>>", liquidity_list_result.stdout, liquidity_list_result.stderr) + liquidity_list_result = json.loads(liquidity_list_result.stdout) + assert liquidity_list_result["success"] is False + assert result_output["err_msg"] == "No liquidity positions found." assert liquidity_list_result["positions"] == [] diff --git a/tests/e2e_tests/test_staking_sudo.py b/tests/e2e_tests/test_staking_sudo.py index 4096c87b0..6bcaa60cc 100644 --- a/tests/e2e_tests/test_staking_sudo.py +++ b/tests/e2e_tests/test_staking_sudo.py @@ -325,6 +325,32 @@ def test_staking(local_chain, wallet_setup): start_subnet_emissions.stdout ) + # Add initial stake to enable V3 + for netuid_ in multiple_netuids: + stake_to_enable_v3 = exec_command_alice( + command="stake", + sub_command="add", + extra_args=[ + "--netuid", + netuid_, + "--wallet-path", + wallet_path_alice, + "--wallet-name", + wallet_alice.name, + "--hotkey", + wallet_alice.hotkey_str, + "--chain", + "ws://127.0.0.1:9945", + "--amount", + "1", + "--unsafe", + "--no-prompt", + "--era", + "144", + ], + ) + assert "✅ Finalized" in stake_to_enable_v3.stdout, stake_to_enable_v3.stderr + # Add stake to Alice's hotkey add_stake_single = exec_command_alice( command="stake", diff --git a/tests/e2e_tests/test_unstaking.py b/tests/e2e_tests/test_unstaking.py index d4e3eef76..f3173b5a7 100644 --- a/tests/e2e_tests/test_unstaking.py +++ b/tests/e2e_tests/test_unstaking.py @@ -215,6 +215,32 @@ def test_unstaking(local_chain, wallet_setup): register_result.stdout ) + # Add initial stake to enable V3 + for netuid_ in [0, 2, 3]: + stake_to_enable_v3 = exec_command_bob( + command="stake", + sub_command="add", + extra_args=[ + "--netuid", + netuid_, + "--wallet-path", + wallet_path_bob, + "--wallet-name", + wallet_bob.name, + "--hotkey", + wallet_bob.hotkey_str, + "--chain", + "ws://127.0.0.1:9945", + "--amount", + "1", + "--unsafe", + "--no-prompt", + "--era", + "144", + ], + ) + assert "✅ Finalized" in stake_to_enable_v3.stdout, stake_to_enable_v3.stderr + # Add stake to subnets for netuid in [0, 2, 3]: stake_result = exec_command_bob( diff --git a/tests/e2e_tests/test_wallet_interactions.py b/tests/e2e_tests/test_wallet_interactions.py index 9dd3ea4f1..3b92c4965 100644 --- a/tests/e2e_tests/test_wallet_interactions.py +++ b/tests/e2e_tests/test_wallet_interactions.py @@ -421,7 +421,7 @@ def test_wallet_identities(local_chain, wallet_setup): wallet_alice.name, "--wallet-hotkey", wallet_alice.hotkey_str, - "--name", + "--id-name", alice_identity["name"], "--web-url", alice_identity["url"],