Skip to content

refactor(validator): dedupe metagraph guards in PAT axon handlers - #1595

Closed
ebios-star wants to merge 1 commit into
entrius:testfrom
ebios-star:refactor/dedupe-pat-handler-guards-test
Closed

refactor(validator): dedupe metagraph guards in PAT axon handlers#1595
ebios-star wants to merge 1 commit into
entrius:testfrom
ebios-star:refactor/dedupe-pat-handler-guards-test

Conversation

@ebios-star

Copy link
Copy Markdown
Contributor

Summary

The PAT axon handler pairs in gittensor/validator/pat_handler.py carried byte-for-byte identical bodies:

  • blacklist_pat_broadcast and blacklist_pat_check both ran the same unregistered-hotkey rejection.
  • priority_pat_broadcast and priority_pat_check both ran the same stake lookup.

This extracts two small module-level helpers — _blacklist_if_unregistered and _stake_priority — so each guard lives in one place and the broadcast/check pairs can't silently drift apart. The four public async handlers keep identical signatures and simply delegate; behavior is unchanged.

Related Issues

None.

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Other (describe below)

Testing

  • Tests added/updated — existing tests/validator/test_pat_handler.py (27 tests) covers all four handlers and passes unchanged.
  • Manually tested — full suite 952 passed; ruff check + ruff format --check clean; pyright reports 0 errors.

No CLI output is affected (internal validator refactor), so no before/after evidence is required.

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Changes are documented (if applicable)

The broadcast/check handler pairs carried byte-for-byte identical bodies:
blacklist_pat_broadcast/blacklist_pat_check shared the same unregistered-hotkey
rejection, and priority_pat_broadcast/priority_pat_check shared the same stake
lookup. Extract two small module-level helpers, _blacklist_if_unregistered and
_stake_priority, so each guard lives in one place and the handler pairs can't
drift out of sync. Public handler signatures and behavior are unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@xiao-xiao-mao xiao-xiao-mao Bot added the refactor Code restructuring without behavior change label Jul 7, 2026
@anderdc

anderdc commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

unnecessary dedup

@anderdc anderdc closed this Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Code restructuring without behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants