fix(validator): fall back to last-known-good PAT snapshot on transient read failure#1608
Open
RealDiligent wants to merge 1 commit into
Open
fix(validator): fall back to last-known-good PAT snapshot on transient read failure#1608RealDiligent wants to merge 1 commit into
RealDiligent wants to merge 1 commit into
Conversation
When miner_pats.json is transiently unreadable, load_all_pats() now falls back to the last successful in-memory snapshot instead of returning an empty list that treats every miner as PAT-less and misallocates OSS emissions. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Fixes #1603
Summary
Fixes a subnet-wide scoring correctness bug where a transient
miner_pats.jsonread failure caused every miner to be treated as PAT-less for the round, misallocating ~90% of OSS emissions to the recycle UID.Root cause
load_all_pats()intentionally fail-opened to[]onJSONDecodeError/OSErrorso scoring would not crash. PR #1486 hardened the write path, but the per-round read snapshot still returned an empty list. With no PATs in the snapshot, all miners failed validation and the evaluation-cache fallback was skipped.Fix approach
Keep an in-memory last-known-good PAT snapshot updated on every successful read/write. On transient read failure after at least one successful snapshot, return that snapshot instead of
[].Impact
Validators continue scoring miners correctly during brief PAT-store read glitches instead of zeroing the entire round.
Risk / tradeoffs
gitt miner postcoverage silently and permanently erodes after validator restarts — valid miners are de-scored with no signal and no recovery #1481 / fix(validator): fail closed on unreadable PAT store instead of wiping it #1486).Test plan
test_load_corrupt_file_falls_back_to_last_snapshot