Skip to content

Commit ccefd9c

Browse files
Eric Priceclaude
andcommitted
feat(vardiff): replace threshold-ladder with the decline-safety champion
Replace the all-pub threshold-ladder VardiffState with a flat-struct adaptive EWMA controller — the decline-safety-selected champion, the clean production extraction of the algorithm derived in stratum-mining#2154. Single-struct replacement: no trait scaffolding, no alternative implementations. Three inline stages (behaviorally identical to the champion_composed reference that passes the decline-safety gate in stratum-mining#2154): - Estimator: EWMA, tau=360s (the τ-safety-valley floor; shorter windows fail the slow-decline gate at sparse rates). - Boundary: adaptive at a seam of 6 spm — PoissonCI below (sparse-data conservatism), sign-persistence CUSUM at/above. The boundary protects the dangerous (tightening) direction two ways: an 8× asymmetric multiplier and a sign-persistence discount that relaxes only after consecutive same-direction ticks. This is decline-safety / dangerous-direction protection — NOT a "tightening rejects in-flight shares" cost (it doesn't: the pool validates each share against the per-job target snapshotted at job creation, which the vardiff path never mutates). - Update: accelerating partial retarget, eta 0.2 → 0.6. Selected by a decline-safety minimax (a hard no-spiral constraint), not a scalar fitness score — which is why the asymmetry is strong (8×): a safety constraint demands more tightening-reluctance than a stability-weighted fitness metric. Breaking: adds private fields to VardiffState (requires channels_sv2 major bump); shares_since_last_update now means "shares since last evaluation tick." Public constructors (new, new_with_min) and the Vardiff trait are unchanged. Tests: implementation-specific suite in test/classic.rs asserting the champion's contract (sustained-evidence tightening reluctance, the asymmetry, the boundary seam, partial-retarget damping), plus a teeth-bearing reset-cleanliness invariant for the sign-persistence state. 15 vardiff tests; fmt clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 6be1267 commit ccefd9c

4 files changed

Lines changed: 641 additions & 581 deletions

File tree

0 commit comments

Comments
 (0)