From a25911eb5af4395027c6102832be4d194cddc1e2 Mon Sep 17 00:00:00 2001 From: Antonis Geralis <43617260+planetis-m@users.noreply.github.com> Date: Fri, 4 Dec 2026 15:03:18 +0200 Subject: [PATCH] yrc: state that the epoch period is never 0 finishCollection divides by YrcEpochLen * slotsInPlay(). slotsInPlay only promises 0 <= result, but gParSlots starts at 1 and only grows, so the divisor is never 0. Say so with an assume, so a prover (Nimony's staticContracts, which now treats a divisor as an obligation) can discharge it. Co-Authored-By: Claude Opus 5.5 --- lib/system/yrc.nim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/system/yrc.nim b/lib/system/yrc.nim index 46dd891a5d123..aa11f4099be9c 100644 --- a/lib/system/yrc.nim +++ b/lib/system/yrc.nim @@ -1700,8 +1700,10 @@ proc finishCollection() = # defer a rescan for. The counter is global, so with N collectors in play # it ticks N times per heap-collection; scale the period to match, or each # thread re-traces its whole old generation every YrcEpochLen/N collections. + let inPlay = slotsInPlay() + {.assume: 1 <= inPlay.} # gParSlots starts at 1 and only grows if atomicAddFetch(addr gCollectionCounter, 1, ATOMIC_RELAXED) mod - (YrcEpochLen * slotsInPlay()) == 0: + (YrcEpochLen * inPlay) == 0: discard atomicAddFetch(addr gEpoch, 1, ATOMIC_RELAXED) {.assume: 0 <= gCtx.slot and gCtx.slot < MaxPar.} # claimed in startCollection if gCtx.parked: