feat: entropy profile temporal validation for anomaly detection#4175
feat: entropy profile temporal validation for anomaly detection#4175AKIB473 wants to merge 1 commit intoScottcjn:mainfrom
Conversation
- miner_fingerprint_history table (last 10 snapshots per miner) - validate_temporal_consistency() function - Detection of frozen profiles (emulator detection) - Detection of noisy profiles (spoofing detection) - Expected drift bands per check type - Unit tests with synthetic profiles Wallet: miner-20260508-rustchain
|
Welcome to RustChain! Thanks for your first pull request. Before we review, please make sure:
Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150) A maintainer will review your PR soon. Thanks for contributing! |
fengqiankun6-sudo
left a comment
There was a problem hiding this comment.
PR #4175 Review: Entropy Profile Temporal Validation
Overall: ✅ LGTM — Good anomaly detection implementation
Analysis
What it does:
- Tracks last 10 fingerprint snapshots per miner
- Implements temporal consistency validation to detect:
- "Frozen" profiles (zero variance → emulator detection)
- "Noisy" profiles (random spoofing detection)
- Integration with reward calculation
Strengths:
- Clear docstrings explaining the threat model
- Good variance threshold logic
- Proper dataclass structure for snapshots
- Integration test coverage
Issues:
-
⚠️ Snapshot size limit: Only stores 10 snapshots in memory — if a miner generates many fingerprints between reward calculations, older snapshots get dropped. Consider persisting or increasing the window. -
⚠️ No upper bound on variance check: The "noisy" profile detection has a lower bound (variance > 0.01) but what about an upper bound? Some hardware genuinely has high variance. Consider adding a sanity cap. -
⚠️ datetime.now()in validate function: Callingdatetime.now()inside the validation loop could cause issues with batch processing. Pass timestamp as argument for testability.
Minor:
README_ENTROPY.mdis a good addition- The entropy calculation (
hashlib.sha256on fingerprint bytes) is solid
Good work.
Implements temporal validation of entropy profiles. Detects frozen (emulator) and noisy (spoofing) profiles. Wallet: miner-20260508-rustchain