Skip to content

fix(validator): fall back to last-known-good PAT snapshot on transient read failure#1608

Open
RealDiligent wants to merge 1 commit into
entrius:testfrom
RealDiligent:fix/critical-issue-pat-read-fallback
Open

fix(validator): fall back to last-known-good PAT snapshot on transient read failure#1608
RealDiligent wants to merge 1 commit into
entrius:testfrom
RealDiligent:fix/critical-issue-pat-read-fallback

Conversation

@RealDiligent

@RealDiligent RealDiligent commented Jul 8, 2026

Copy link
Copy Markdown

Fixes #1603

Summary

Fixes a subnet-wide scoring correctness bug where a transient miner_pats.json read 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 [] on JSONDecodeError / OSError so 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

Test plan

@xiao-xiao-mao xiao-xiao-mao Bot added the bug Something isn't working label Jul 8, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(validator): transient miner_pats.json read failure zeroes entire scoring round

1 participant