Skip to content

fix(dendrite): skip axon on is_validator RPC failure instead of silently including (#168)#300

Open
RUNECTZ33 wants to merge 1 commit into
entrius:testfrom
RUNECTZ33:fix/168-dendrite-bare-except
Open

fix(dendrite): skip axon on is_validator RPC failure instead of silently including (#168)#300
RUNECTZ33 wants to merge 1 commit into
entrius:testfrom
RUNECTZ33:fix/168-dendrite-bare-except

Conversation

@RUNECTZ33
Copy link
Copy Markdown

Summary

Closes #168.

dendrite_lite.discover_validators (allways/cli/dendrite_lite.py:60-66) wraps contract_client.is_validator(...) in try / except Exception: pass. The pass falls through to axons.append(axon), so any RPC failure during validator-permit checking silently includes the unverified hotkey in the CLI broadcast list. Issue #73 / PR #92 already addressed the same pattern on the validator-side dendrite — CLI parity here.

Change

-            except Exception:
-                pass
+            except Exception as e:
+                bt.logging.debug(
+                    f'Skipping uid={uid} hotkey={metagraph.hotkeys[uid][:12]}...: '
+                    f'is_validator RPC failed: {e}'
+                )
+                continue

Bind the exception, log a debug message naming the uid + hotkey prefix + RPC error, and continue. Matches the existing continue branches above for not validator_permit and not is_serving.

Why this is safe

  • The function's contract is "return the validator-permit-AND-is-validator-confirmed list." Silently including hotkeys that weren't confirmed violates that contract.
  • The CLI swap flow downstream of discover_validators rejects responses from non-validators — surfacing via confusing rejection rather than quietly skipping that hotkey upstream. Better to drop early.
  • Debug-level log preserves diagnostic info for operators running with --logging.debug without polluting the normal CLI experience.

Scope

allways/cli/dendrite_lite.py: +11 / -2. No new imports (bt.logging already imported).

Test plan

…tly including (entrius#168)

dendrite_lite.discover_validators wrapped contract_client.is_validator
in 'try / except Exception: pass'. The pass falls through to
axons.append(axon), so any RPC failure during validator-permit checking
silently includes the unverified hotkey in the broadcast list.

Issue entrius#73 / PR entrius#92 already addressed the same pattern on the
validator-side dendrite. CLI dendrite needs parity.

Fix: bind the exception, log a debug message naming the uid + hotkey
prefix + RPC error, and 'continue' so unverified hotkeys are dropped
from the axon list. Matches the existing 'continue' branches above for
'no validator_permit' and 'not is_serving'.

Closes entrius#168
@xiao-xiao-mao xiao-xiao-mao Bot added the bug Something isn't working label May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dendrite_lite.py swallows is_validator exceptions with a bare except

1 participant