-
Notifications
You must be signed in to change notification settings - Fork 32
Feat/enforce no re reg #619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🤖 Claude AI Code ReviewLast reviewed on: 14:23:47 SummaryThis PR implements a re-registration prevention system that tracks miners who de-register from the subnet and prevents them from re-registering. The implementation includes:
✅ Strengths
|
Implements automatic tracking of miners that de-register and attempt to re-register, permanently blocking their orders from being processed. Changes: - Track all departed hotkeys with anomaly detection (>10 hotkeys AND >=25%) - Persist departed hotkeys to JSON for recovery after restarts - Validator rejects orders from re-registered miners - Add comprehensive test suite (15 tests, all passing) Resolves issue where miners could circumvent elimination by re-registering. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Changes departed_hotkeys from list to dict to enable:
- Fast O(1) lookups instead of O(n) with set conversion
- Metadata storage (detected_ms, block number) for debugging
- Future extensibility (can add more metadata fields)
Structure:
{
"hotkey": {
"detected_ms": timestamp,
"block": block_number
}
}
Includes backwards compatibility for legacy list format.
All 15 tests pass.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Created shared utility module for detecting anomalous hotkey loss to eliminate code duplication between elimination_manager.py and metagraph_updater.py. Changes: - Added shared_objects/metagraph_utils.py with is_anomalous_hotkey_loss() - Moved anomaly detection constants to shared module (>10 hotkeys AND >=25%) - Updated elimination_manager.py to use shared function - Updated metagraph_updater.py to use shared function - Updated test imports to reference new module location All 15 re-registration tests pass successfully.
Simplified departed hotkeys metadata to only store detection timestamp. Block number tracking was unnecessary for the re-registration detection feature. Changes: - Removed "block" field from departed_hotkeys metadata dict - Updated backwards compatibility code to not include block - Updated docstring to reflect single metadata field - Updated test to only verify detected_ms field All 15 re-registration tests pass successfully.
…essage Enhanced the error message shown to re-registered miners to include the specific date when they were de-registered, making it more informative. Changes: - Retrieve detected_ms from departed_hotkeys metadata - Convert timestamp to UTC date format using TimeUtil.millis_to_formatted_date_str() - Update error message to include: "De-registered on: YYYY-MM-DD HH:MM:SS UTC" Example message: "This miner hotkey 5ABC... was previously de-registered and is not allowed to re-register. De-registered on: 2025-01-15 14:32:45 UTC. Re-registration is not permitted on this subnet." All 15 re-registration tests pass successfully.
d19ea53 to
36213cb
Compare
Taoshi Pull Request
Description
[Provide a brief description of the changes introduced by this pull request.]
Related Issues (JIRA)
[Reference any related issues or tasks that this pull request addresses or closes.]
Checklist
Reviewer Instructions
[Provide any specific instructions or areas you would like the reviewer to focus on.]
Definition of Done
Checklist (for the reviewer)
Optional: Deploy Notes
[Any instructions or notes related to deployment, if applicable.]
/cc @mention_reviewer