From 1b5fb6b2f3cc6dcdd5e7574721d5a3d39f77c261 Mon Sep 17 00:00:00 2001 From: dylan Date: Fri, 21 Aug 2026 22:38:53 +0000 Subject: [PATCH 1/2] fix: detach block callbacks from substrate subscription handler Block callbacks were awaited inside the subscription handler, so any callback running longer than 120s stalled header processing, tripped the staleness watchdog, and was cancelled mid-flight. The generator challenge sweep exceeds 120s, so challenges were never issued. - Run block callbacks as detached tasks so header processing never stalls - Bound the miner-type sweep with a 10s socket connect timeout - Disable the startup weight set --- gas/evaluation/miner_type_tracker.py | 4 ++++ gas/utils/metagraph.py | 13 ++++++++++++- neurons/validator/validator.py | 3 ++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/gas/evaluation/miner_type_tracker.py b/gas/evaluation/miner_type_tracker.py index 48b27615..4c2d78bf 100644 --- a/gas/evaluation/miner_type_tracker.py +++ b/gas/evaluation/miner_type_tracker.py @@ -64,6 +64,10 @@ async def update_miner_types(self, miner_uids: Optional[List[int]] = None, force session, self.wallet.hotkey, self.config.neuron.miner_total_timeout, + # Unreachable axons drop packets rather than refuse; + # without a connect bound they hold the sweep open + # until the total timeout. + sock_connect_timeout=10, ) for uid in miner_uids ], diff --git a/gas/utils/metagraph.py b/gas/utils/metagraph.py index eaf9ee36..c848ad9d 100644 --- a/gas/utils/metagraph.py +++ b/gas/utils/metagraph.py @@ -138,6 +138,7 @@ def __init__(self, url: str, ss58_format: int, type_registry: dict): self.type_registry = type_registry self.running = False self.task = None + self._callback_tasks = set() async def _connect_and_subscribe(self, callback: Callable): bt.logging.info(f"Connecting to async substrate: {self.url}") @@ -166,9 +167,19 @@ async def _run_subscription_attempt(self, callback: Callable): """Run one subscription attempt and always reap its child tasks.""" block_received = asyncio.Event() + def _reap_callback_task(task): + self._callback_tasks.discard(task) + if not task.cancelled() and task.exception() is not None: + bt.logging.error(f"Block callback task failed: {task.exception()}") + async def tracked_callback(block): block_received.set() - await callback(block) + # Detach callbacks from header processing: a slow callback (e.g. + # the miner-type sweep) must not stall the subscription and trip + # the staleness watchdog, which cancels this attempt's tasks. + task = asyncio.create_task(callback(block)) + self._callback_tasks.add(task) + task.add_done_callback(_reap_callback_task) subscription_task = asyncio.create_task( self._connect_and_subscribe(tracked_callback) diff --git a/neurons/validator/validator.py b/neurons/validator/validator.py index b466c013..89a63f96 100644 --- a/neurons/validator/validator.py +++ b/neurons/validator/validator.py @@ -143,7 +143,8 @@ async def run(self): "\N{GRINNING FACE WITH SMILING EYES}", f"Initialization Complete. Validator starting at block: {self.subtensor.block}", ) - await self.set_weights(0) + # await self.set_weights(0) + # await self.issue_generator_challenge(0) while not self.exit_context.isExiting: self.step += 1 if self.config.autoupdate and (self.step == 0 or not self.step % 300): From 9a63a17d73b32d44af11bcf7a1a5f337ac653cd5 Mon Sep 17 00:00:00 2001 From: dylan Date: Fri, 21 Aug 2026 22:53:51 +0000 Subject: [PATCH 2/2] bump version to 4.9.9 --- VERSION | 2 +- gas/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index de9a5512..3f5820b5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.9.8 +4.9.9 diff --git a/gas/__init__.py b/gas/__init__.py index 72689c2b..5635b1b8 100644 --- a/gas/__init__.py +++ b/gas/__init__.py @@ -1,4 +1,4 @@ -__version__ = "4.9.8" +__version__ = "4.9.9" version_split = __version__.split(".") __spec_version__ = (