Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for hotkey names in -in and -ex in stake add/remove #191

Open
UselessXiaoYao opened this issue Oct 17, 2024 · 3 comments
Open
Assignees
Labels
enhancement New feature or request

Comments

@UselessXiaoYao
Copy link

(.venv) ubuntu@c2-large-x86-syd-1:~/workspace/yzp$ python3 --version
Python 3.10.12
(.venv) ubuntu@c2-large-x86-syd-1:~/workspace/yzp$ pip show bittensor
Name: bittensor
Version: 8.2.0
Summary: bittensor
Home-page: https://github.com/opentensor/bittensor
Author: bittensor.com
Author-email: 
License: MIT
Location: /home/ubuntu/workspace/yzp/.venv/lib/python3.10/site-packages
Requires: aiohttp, bittensor-cli, bittensor-wallet, bt-decode, colorama, fastapi, msgpack-numpy-opentensor, munch, nest-asyncio, netaddr, numpy, packaging, pydantic, python-Levenshtein, python-statemachine, pyyaml, requests, retry, rich, scalecodec, setuptools, substrate-interface, uvicorn, wheel
Required-by: 
(.venv) ubuntu@c2-large-x86-syd-1:~/workspace/yzp$ pip show bittensor_cli
Name: bittensor-cli
Version: 8.2.0
Summary: Bittensor CLI
Home-page: https://github.com/opentensor/btcli
Author: bittensor.com
Author-email: 
License: MIT
Location: /home/ubuntu/workspace/yzp/.venv/lib/python3.10/site-packages
Requires: aiohttp, async-property, backoff, bittensor-wallet, bt-decode, fuzzywuzzy, GitPython, Jinja2, netaddr, numpy, pycryptodome, pytest, python-Levenshtein, PyYAML, rich, scalecodec, substrate-interface, typer, websockets, wheel
Required-by: bittensor
(.venv) ubuntu@c2-large-x86-syd-1:~/workspace/yzp$ pip show bittensor_wallet
Name: bittensor-wallet
Version: 2.0.2
Summary: 
Home-page: 
Author: 
Author-email: Roman Chkhaidze <[email protected]>
License: 
Location: /home/ubuntu/workspace/yzp/.venv/lib/python3.10/site-packages
Requires: ansible, ansible-vault, cryptography, eth-utils, munch, password-strength, py-bip39-bindings, rich, termcolor
Required-by: bittensor, bittensor-cli

When I use "btcli st remove --wallet.name mywallet --in hk1,hk2 --all", it report error, "Invalid value: Invalid SS58 address: hk1"

@thewhaleking thewhaleking added the bug Something isn't working label Oct 22, 2024
@thewhaleking thewhaleking self-assigned this Nov 1, 2024
@thewhaleking
Copy link
Contributor

thewhaleking commented Nov 1, 2024

Caused by this function:

def parse_to_list(
    raw_list: str, list_type: type, error_message: str, is_ss58: bool = False
) -> list:
    try:
        # Split the string by commas and convert each part to according to type
        parsed_list = [
            list_type(uid.strip()) for uid in raw_list.split(",") if uid.strip()
        ]

        # Validate in-case of ss58s
        if is_ss58:
            for item in parsed_list:
                if not is_valid_ss58_address(item):
                    raise typer.BadParameter(f"Invalid SS58 address: {item}")

        return parsed_list
    except ValueError:
        raise typer.BadParameter(error_message)

We must change the way we're handling this on items for include/exclude hotkeys on:

  • stake add
  • stake remove

@thewhaleking
Copy link
Contributor

Hey @UselessXiaoYao
We're currently discussing whether or not to add support for hotkey names in this. Currently, as he help text for that option indicates, only the ss58 addresses are considered valid for that option.

@thewhaleking thewhaleking added enhancement New feature or request and removed bug Something isn't working labels Nov 4, 2024
@thewhaleking thewhaleking changed the title Use "-in hk1,hk2" can not recognize hotkey name Add support for hotkey names in -in and -ex in stake add/remove Nov 4, 2024
@thewhaleking
Copy link
Contributor

PR #216 adds support for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants