Skip to content

Commit

Permalink
Merge pull request #51 from opentensor/no-reregister-wallet
Browse files Browse the repository at this point in the history
No reregister wallet
  • Loading branch information
p-ferreira authored Nov 1, 2023
2 parents e2b3f0c + dbbdd8a commit 0d29685
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 19 deletions.
2 changes: 1 addition & 1 deletion docs/running_a_validator.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ btcli wallet faucet --wallet.name validator --subtensor.network test
Register your UID on the test network:

```sh
btcli wallet recycle_register --subtensor.network test
btcli subnets register --subtensor.network test
```

## 5. Start the Process
Expand Down
3 changes: 1 addition & 2 deletions neurons/miners/bittensorLM/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ usage: miner.py [-h] [--axon.port AXON.PORT] [--subtensor.network SUBTENSOR.NETW
[--miner.blacklist.force_validator_permit] [--miner.blacklist.allow_non_registered] [--miner.blacklist.minimum_stake_requirement MINER.BLACKLIST.MINIMUM_STAKE_REQUIREMENT]
[--miner.blacklist.prompt_cache_block_span MINER.BLACKLIST.PROMPT_CACHE_BLOCK_SPAN] [--miner.blacklist.use_prompt_cache] [--miner.blacklist.min_request_period MINER.BLACKLIST.MIN_REQUEST_PERIOD]
[--miner.priority.default MINER.PRIORITY.DEFAULT] [--miner.priority.time_stake_multiplicate MINER.PRIORITY.TIME_STAKE_MULTIPLICATE]
[--miner.priority.len_request_timestamps MINER.PRIORITY.LEN_REQUEST_TIMESTAMPS] [--miner.no_set_weights] [--miner.no_serve] [--miner.no_start_axon] [--miner.no_register] [--miner.mock_subtensor] [--wandb.on]
[--miner.priority.len_request_timestamps MINER.PRIORITY.LEN_REQUEST_TIMESTAMPS] [--miner.no_set_weights] [--miner.no_serve] [--miner.no_start_axon] [--miner.mock_subtensor] [--wandb.on]
[--wandb.project_name WANDB.PROJECT_NAME] [--wandb.entity WANDB.ENTITY] [--logging.debug] [--logging.trace] [--logging.record_log] [--logging.logging_dir LOGGING.LOGGING_DIR] [--wallet.name WALLET.NAME]
[--wallet.hotkey WALLET.HOTKEY] [--wallet.path WALLET.PATH] [--config CONFIG] [--strict] [--no_version_checking] [--no_prompt]
Expand Down Expand Up @@ -60,7 +60,6 @@ options:
--miner.no_serve If True, the miner doesnt serve the axon.
--miner.no_start_axon
If True, the miner doesnt start the axon.
--miner.no_register If True, the miner doesnt register its wallet.
--miner.mock_subtensor
If True, the miner will allow non-registered hotkeys to mine.
--wandb.on Turn on wandb.
Expand Down
3 changes: 1 addition & 2 deletions neurons/miners/openai/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ usage: miner.py [-h] [--axon.port AXON.PORT] [--subtensor.network SUBTENSOR.NETW
[--miner.blacklist.force_validator_permit] [--miner.blacklist.allow_non_registered] [--miner.blacklist.minimum_stake_requirement MINER.BLACKLIST.MINIMUM_STAKE_REQUIREMENT]
[--miner.blacklist.prompt_cache_block_span MINER.BLACKLIST.PROMPT_CACHE_BLOCK_SPAN] [--miner.blacklist.use_prompt_cache] [--miner.blacklist.min_request_period MINER.BLACKLIST.MIN_REQUEST_PERIOD]
[--miner.priority.default MINER.PRIORITY.DEFAULT] [--miner.priority.time_stake_multiplicate MINER.PRIORITY.TIME_STAKE_MULTIPLICATE]
[--miner.priority.len_request_timestamps MINER.PRIORITY.LEN_REQUEST_TIMESTAMPS] [--miner.no_set_weights] [--miner.no_serve] [--miner.no_start_axon] [--miner.no_register] [--miner.mock_subtensor] [--wandb.on]
[--miner.priority.len_request_timestamps MINER.PRIORITY.LEN_REQUEST_TIMESTAMPS] [--miner.no_set_weights] [--miner.no_serve] [--miner.no_start_axon] [--miner.mock_subtensor] [--wandb.on]
[--wandb.project_name WANDB.PROJECT_NAME] [--wandb.entity WANDB.ENTITY] [--logging.debug] [--logging.trace] [--logging.record_log] [--logging.logging_dir LOGGING.LOGGING_DIR] [--wallet.name WALLET.NAME]
[--wallet.hotkey WALLET.HOTKEY] [--wallet.path WALLET.PATH] [--config CONFIG] [--strict] [--no_version_checking] [--no_prompt]
Expand Down Expand Up @@ -84,7 +84,6 @@ options:
--miner.no_serve If True, the miner doesnt serve the axon.
--miner.no_start_axon
If True, the miner doesnt start the axon.
--miner.no_register If True, the miner doesnt register its wallet.
--miner.mock_subtensor
If True, the miner will allow non-registered hotkeys to mine.
--wandb.on Turn on wandb.
Expand Down
3 changes: 1 addition & 2 deletions neurons/miners/vicuna/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ usage: miner.py [-h] [--axon.port AXON.PORT] [--subtensor.network SUBTENSOR.NETW
[--miner.blacklist.force_validator_permit] [--miner.blacklist.allow_non_registered] [--miner.blacklist.minimum_stake_requirement MINER.BLACKLIST.MINIMUM_STAKE_REQUIREMENT]
[--miner.blacklist.prompt_cache_block_span MINER.BLACKLIST.PROMPT_CACHE_BLOCK_SPAN] [--miner.blacklist.use_prompt_cache] [--miner.blacklist.min_request_period MINER.BLACKLIST.MIN_REQUEST_PERIOD]
[--miner.priority.default MINER.PRIORITY.DEFAULT] [--miner.priority.time_stake_multiplicate MINER.PRIORITY.TIME_STAKE_MULTIPLICATE]
[--miner.priority.len_request_timestamps MINER.PRIORITY.LEN_REQUEST_TIMESTAMPS] [--miner.no_set_weights] [--miner.no_serve] [--miner.no_start_axon] [--miner.no_register] [--miner.mock_subtensor] [--wandb.on]
[--miner.priority.len_request_timestamps MINER.PRIORITY.LEN_REQUEST_TIMESTAMPS] [--miner.no_set_weights] [--miner.no_serve] [--miner.no_start_axon] [--miner.mock_subtensor] [--wandb.on]
[--wandb.project_name WANDB.PROJECT_NAME] [--wandb.entity WANDB.ENTITY] [--logging.debug] [--logging.trace] [--logging.record_log] [--logging.logging_dir LOGGING.LOGGING_DIR] [--wallet.name WALLET.NAME]
[--wallet.hotkey WALLET.HOTKEY] [--wallet.path WALLET.PATH] [--config CONFIG] [--strict] [--no_version_checking] [--no_prompt]
Expand Down Expand Up @@ -115,7 +115,6 @@ options:
--miner.no_serve If True, the miner doesnt serve the axon.
--miner.no_start_axon
If True, the miner doesnt start the axon.
--miner.no_register If True, the miner doesnt register its wallet.
--miner.mock_subtensor
If True, the miner will allow non-registered hotkeys to mine.
--wandb.on Turn on wandb.
Expand Down
6 changes: 0 additions & 6 deletions prompting/baseminer/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,6 @@ def get_config() -> "bt.Config":
help="If True, the miner doesnt start the axon.",
default=False,
)
parser.add_argument(
"--miner.no_register",
action="store_true",
help="If True, the miner doesnt register its wallet.",
default=False,
)

# Mocks.
parser.add_argument(
Expand Down
16 changes: 10 additions & 6 deletions prompting/baseminer/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def run(self):
Initiates and manages the main loop for the miner on the Bittensor network.
This function performs the following primary tasks:
1. Optionally registers the miner's wallet with the network.
1. Check for registration on the Bittensor network.
2. Attaches the miner's forward, blacklist, and priority functions to its axon.
3. Starts the miner's axon, making it active on the network.
4. Regularly updates the metagraph with the latest network state.
Expand All @@ -48,12 +48,16 @@ def run(self):
KeyboardInterrupt: If the miner is stopped by a manual interruption.
Exception: For unforeseen errors during the miner's operation, which are logged for diagnosis.
"""
# --- Optionally register the wallet.
if not self.config.miner.no_register:
bt.logging.info(
f"Registering wallet: {self.wallet} on netuid {self.config.netuid}"
# --- Check for registration.
if not self.subtensor.is_hotkey_registered(
netuid=self.config.netuid,
hotkey=self.wallet.hotkey.ss58_address,
):
bt.logging.error(
f"Wallet: {self.wallet} is not registered on netuid {self.config.netuid}"
f"Please register the hotkey using `btcli subnets register` before trying again"
)
self.subtensor.register(netuid=self.config.netuid, wallet=self.wallet)
exit()

# Serve passes the axon information to the network + netuid we are hosting on.
# This will auto-update if the axon port of external ip have changed.
Expand Down

0 comments on commit 0d29685

Please sign in to comment.