From 3c784c699e5e9c70e40c91d84383f6d4a1c06a01 Mon Sep 17 00:00:00 2001 From: Lance-Python-Dev Date: Tue, 19 May 2026 09:01:07 +0100 Subject: [PATCH] fix: guard handle_pat_check against unregistered hotkey - Closes #1297 --- gittensor/validator/pat_handler.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gittensor/validator/pat_handler.py b/gittensor/validator/pat_handler.py index 1c6d9b78..8d0c3d68 100644 --- a/gittensor/validator/pat_handler.py +++ b/gittensor/validator/pat_handler.py @@ -105,6 +105,11 @@ async def priority_pat_broadcast(validator: 'Validator', synapse: PatBroadcastSy async def handle_pat_check(validator: 'Validator', synapse: PatCheckSynapse) -> PatCheckSynapse: """Check if the validator has the miner's PAT stored and re-validate it.""" hotkey = _get_hotkey(synapse) + if hotkey not in validator.metagraph.hotkeys: + synapse.has_pat = False + synapse.pat_valid = False + synapse.rejection_reason = 'Hotkey not registered on subnet' + return synapse uid = validator.metagraph.hotkeys.index(hotkey) entry = pat_storage.get_pat_by_uid(uid)