refactor(validator): dedupe metagraph guards in PAT axon handlers - #1595
Closed
ebios-star wants to merge 1 commit into
Closed
refactor(validator): dedupe metagraph guards in PAT axon handlers#1595ebios-star wants to merge 1 commit into
ebios-star wants to merge 1 commit into
Conversation
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>
Collaborator
|
unnecessary dedup |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The PAT axon handler pairs in
gittensor/validator/pat_handler.pycarried byte-for-byte identical bodies:blacklist_pat_broadcastandblacklist_pat_checkboth ran the same unregistered-hotkey rejection.priority_pat_broadcastandpriority_pat_checkboth ran the same stake lookup.This extracts two small module-level helpers —
_blacklist_if_unregisteredand_stake_priority— so each guard lives in one place and the broadcast/check pairs can't silently drift apart. The four publicasynchandlers keep identical signatures and simply delegate; behavior is unchanged.Related Issues
None.
Type of Change
Testing
tests/validator/test_pat_handler.py(27 tests) covers all four handlers and passes unchanged.952 passed;ruff check+ruff format --checkclean;pyrightreports 0 errors.No CLI output is affected (internal validator refactor), so no before/after evidence is required.
Checklist