Repository navigation
PRISM: converge tip refreshes on latest epochs - #101
Conversation
Keep both metric blocks at the tip_refresh_metrics_lines seam: the hashrate-coverage histogram from this branch and the serve-builder counters from #99. Co-Authored-By: Claude Fable 5 <[email protected]>
- Reselect clients whose delivered work is a collection job once the pool latches ready, matching the epoch fixpoint so an owning wave cannot re-enter forever with no candidate to serve. - Back off between re-entry passes and bound each wave by a pass budget that hands convergence to the scheduled retry, so sustained tip churn cannot poll template RPCs in a tight loop. - Record a dedicated shutdown wave outcome when stop interrupts convergence instead of reporting the wave completed. Co-Authored-By: Claude Fable 5 <[email protected]>
- Negative control: with the per-connection epoch fence disabled, a queued stale delivery that already passed global validation reaches registration and the socket; the intervening-job comparator admits it and only the fence blocks it. - Regression coverage for delivered-collection reselection under a ready latch, the wave pass budget's scheduled-retry fallback, re-entry gating, and the shutdown wave outcome. Co-Authored-By: Claude Fable 5 <[email protected]>
Keep-both resolutions: PrismJobContext gains both the epoch sequence stamp from this branch and the retained version-rolling mask from #100, at the dataclass and its construction site; .env.example keeps both new entries. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Pushed four commits addressing the Bugbot findings and the review follow-ups, and folding in the two base merges.
Validation on the final tree (post-#99/#100): |
- A wave that declines re-entry because of shutdown now records the shutdown outcome instead of a supersession label, so terminal supersession counts stay meaningful during restarts. Legacy waves never re-enter and keep their supersession outcome. - An initial-job delivery blocked by the per-connection epoch fence completes the pending request against the newer current-tip work the fence proves is registered, instead of retrying into the initial-job deadline disconnect of an already-served client. - A converged wave consumes refresh retries armed before its fixpoint verification, inside the same lock hold that proved convergence, so recovered supersessions no longer leave a stale retry that re-runs a full wave against finished work. Co-Authored-By: Claude Fable 5 <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
|
Round-2 Bugbot findings verified and fixed in
All three fixes were verified to fail their new regression tests against the pre-fix code. Focused suites 574/574; full discover matches the 1.x.x baseline. |
A payout publication advances the payout generation of the target the fleet is already converging on; it must not move or invent the epoch tip. The mint previously preferred the candidate's source hash, and an accepted-block preview stores the accepted block's own hash there — not a template parent, and possibly trailing an already-observed newer tip. Labeling the live epoch with it strands token currency, identity publication, and the fixpoint until a later tip observation remints. The mint now labels from the current epoch tip, then the latest detected or published tip, and never from candidate source hashes. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Verified and fixed in The accepted-block preview publication reserves the payout source with the accepted block's own hash, and the epoch mint preferred Fix: a payout publication advances the payout generation of the target the fleet is already converging on; it must not move or invent the tip. The mint now labels from the current epoch tip, falling back to the latest detected then published tip, and never from candidate source hashes ( Regression tests pin the label-source priority and drive the real accepted-block preview publication, asserting the epoch stays on the observed tip while sequence and payout generation advance; the publication test fails against the pre-fix code with the epoch labeled by the block hash. Focused suites 576/576; full discover matches the 1.x.x baseline. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f37b2c5. Configure here.
The payout publication minted a new epoch but left the published stamping identity on the previous payout generation, so every rebuilt bundle mismatched it and stamped epoch 0 — which the fence blocks for previously admitted connections until the next wave republishes. Initial deliveries stamping through bundle identity could spin on that window and reach the deadline disconnect. Re-anchor the identity in the same lock hold as the mint; the publish helper already no-ops when the epoch tip is not the published snapshot tip, which the owning wave handles. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Verified and fixed in 9d7ba5a: stale identity after payout mint (medium) — real. The payout publication minted a new epoch but left the published stamping identity on the previous payout generation, so every rebuilt bundle mismatched it and stamped epoch 0, which the per-connection fence blocks for previously admitted connections until the next wave republishes the identity. Initial deliveries stamping through bundle identity could spin on that window and reach the deadline disconnect. The mint now re-anchors the identity in the same lock hold; the publish helper already no-ops when the epoch tip is not the published snapshot tip (the owning wave handles that transition). Regression test drives the real accepted-block preview publication and asserts the identity advances with the mint and a rebuilt bundle stamps the minted epoch, not 0; it fails against the pre-fix code. Focused suites 577/577. |
* Revert "Survive production build latency in payout-artifact reuse (2026-07-29 re-land) (#103)" This reverts commit cd32c13. The re-land brownouted mainnet on 2026-07-30 (generation-churn brownout); the payout-artifact reuse line is abandoned and 1.x.x returns to the #101 (e2fb33d) behavior. Co-Authored-By: Claude Fable 5 <[email protected]> * Revert "Make payout-ledger-artifact reuse anchor-scoped so it survives production share rates (#102)" This reverts commit fcc2c3e. Anchor-scoped reuse livelocked mainnet payouts on 2026-07-29 (born-expired artifact livelock); together with the #103 revert this restores the payout-artifact machinery to its #101 (e2fb33d) state: exact-count fence semantics, no staleness/rearm/anchor-age knobs, no admission-deadline machinery. Co-Authored-By: Claude Fable 5 <[email protected]> --------- Co-authored-by: Claude Fable 5 <[email protected]>

Summary
PRISM_TIP_REFRESH_EPOCH_FANOUTsupport so an owning refresh wave can converge on the latest observed tip and payout epoch instead of abandoning progress after supersession.Why
During fast block cadence, refresh waves can be superseded faster than abort-and-retry delivery completes. Re-entering the owning wave with the newest immutable state lets already-admitted sends finish while preventing obsolete queued work from crossing the per-connection epoch fence.
Solved submissions degraded by stale grace and distinct stale-job abandonment causes were also not separately observable, making rollout behavior harder to evaluate.
Operational limits
0; leaving it disabled preserves legacy refresh behavior, and returning it to0is the rollback path.Validation
python3 -m compileall -q docker lab tests examples scriptspython3 -m unittest discover -s tests -p 'test_*.py'git ls-files '*.sh' | xargs bash -ngit ls-files '*.sh' | xargs shellcheck -xconfig --quietfor thepermissionless,real-miner-smoke,auxpow, andprismprofilesgit diff --check origin/1.x.x...HEADNeed help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
High Risk
Changes core PRISM tip-refresh coordination, per-connection job delivery, and block-candidate abandonment paths under fast tip cadence; rollout is gated off by default but enabling it alters live mining behavior and failure classification.
Overview
Adds default-off
PRISM_TIP_REFRESH_EPOCH_FANOUTso the owning tip-refresh wave can re-enter after supersession instead of abort-and-retry, converging fleet delivery on the latest tip/payout epoch while payout publication and chain-trust fences stay authoritative.When enabled, the coordinator mints refresh epochs on tip detection and payout publication, stamps jobs with
tip_refresh_epoch_sequence, and fences per-connection admission so older epochs cannot regress on the wire. Delivery proof still advances only after successful sends; wave re-entry is bounded by pass budget and backoff, with a fixpoint check before the wave completes.Rollout observability: Prometheus counters/histograms for wave outcomes (
completed,build_superseded,fanout_superseded, etc.) and fixed-label hashrate coverage latency (50/95/99 cohorts). Separate metrics for stale-grace block solves dropped and stale-job abandons (tip_movedvsbalance_stale); durable outbox rows record the abandonment message.Docs, Compose, and
.env.exampledocument staged enable and rollback via0.Reviewed by Cursor Bugbot for commit 9d7ba5a. Bugbot is set up for automated code reviews on this repo. Configure here.