Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions neurons/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ async def run(self):
btul.logging.debug(f"Setting weights {self.moving_averaged_scores}")
set_weights_for_validator(
uid=self.uid,
device=self.device,
subtensor=self.subtensor,
wallet=self.wallet,
metagraph=self.metagraph,
Expand Down
13 changes: 4 additions & 9 deletions subnet/validator/challenge.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import bittensor.core.settings as btcse
import bittensor.utils.btlogging as btul
from substrateinterface.base import SubstrateInterface
from websockets.sync import client as ws_client

from subnet.constants import DEFAULT_PROCESS_TIME
from subnet.protocol import Synapse
Expand Down Expand Up @@ -161,25 +160,21 @@ def challenge_subtensor(miner: Miner, challenge):

# Attempt to connect to the subtensor
try:
# Create the websocket
websocket = ws_client.connect(
f"ws://{miner.ip}:9944",
open_timeout=DEFAULT_PROCESS_TIME,
max_size=2**32,
)

# Create the substrate
substrate = SubstrateInterface(
ss58_format=btcse.SS58_FORMAT,
use_remote_preset=True,
type_registry=btcse.TYPE_REGISTRY,
websocket=websocket,
url=f"ws://{miner.ip}:9944",
)

except Exception:
reason = "Failed to connect to Subtensor node at the given IP."
return (verified, reason, process_time)

# Set the socket timeout
substrate.websocket.settimeout(DEFAULT_PROCESS_TIME)

# Start the timer
start_time = time.time()

Expand Down
3 changes: 2 additions & 1 deletion subnet/validator/weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

def set_weights_for_validator(
uid: int,
device: torch.device,
subtensor: "btcs.Subtensor",
wallet: "btw.Wallet",
netuid: int,
Expand Down Expand Up @@ -115,7 +116,7 @@ def set_weights_for_validator(
processed_weight_uids,
processed_weights,
) = btuw.process_weights_for_netuid(
uids=metagraph.uids,
uids=metagraph.uids.to(device),
weights=raw_weights,
netuid=netuid,
subtensor=subtensor,
Expand Down