Skip to content

add slot/interval context to log timestamps via SlotTimeClock#602

Merged
g11tech merged 2 commits intomainfrom
claude/add-timeslot-logging-aBQge
Feb 24, 2026
Merged

add slot/interval context to log timestamps via SlotTimeClock#602
g11tech merged 2 commits intomainfrom
claude/add-timeslot-logging-aBQge

Conversation

@zclawz
Copy link
Copy Markdown
Contributor

@zclawz zclawz commented Feb 24, 2026

Introduces SlotTimeClock, a small struct with two atomic u64 fields (time and timeSlots) that replaces the plain fields in ForkChoiceStore. The forkchoice updates these atomics on every interval tick; the logger reads them lock-free via atomic loads.

ZeamLoggerConfig gains an optional slot_clock: ?*const SlotTimeClock field (default null). When set, compTimeLog appends " [s= i=]" (interval-within-slot = time % 4) after the wall-clock timestamp on every log line, giving developers precise slot/interval timing context.

In node.zig, after BeamChain is placed at its final heap address, logger_config.slot_clock is pointed at chain.forkChoice.fcStore.slot_clock. Loggers created in a proving-manager / STF host context (no forkchoice) leave slot_clock null and are unaffected.

https://claude.ai/code/session_01YU1HeELfEpoJeZy8rNVt3r

Introduces SlotTimeClock, a small struct with two atomic u64 fields
(time and timeSlots) that replaces the plain fields in ForkChoiceStore.
The forkchoice updates these atomics on every interval tick; the logger
reads them lock-free via atomic loads.

ZeamLoggerConfig gains an optional `slot_clock: ?*const SlotTimeClock`
field (default null). When set, compTimeLog appends " [s=<slot> i=<i>]"
(interval-within-slot = time % 4) after the wall-clock timestamp on
every log line, giving developers precise slot/interval timing context.

In node.zig, after BeamChain is placed at its final heap address,
`logger_config.slot_clock` is pointed at `chain.forkChoice.fcStore.slot_clock`.
Loggers created in a proving-manager / STF host context (no forkchoice)
leave slot_clock null and are unaffected.

https://claude.ai/code/session_01YU1HeELfEpoJeZy8rNVt3r
Rather than having log.zig derive the interval-within-slot via
time % INTERVALS_PER_SLOT (which would require the utils package to
know the node-level constant), the forkchoice now stores the already-
computed currentInterval into slot_clock.slotInterval on every tick.

The logger reads slotInterval directly with no arithmetic, and the
INTERVALS_PER_SLOT constant is removed from log.zig entirely.

https://claude.ai/code/session_01YU1HeELfEpoJeZy8rNVt3r
@g11tech g11tech changed the title Add slot/interval context to log timestamps via SlotTimeClock add slot/interval context to log timestamps via SlotTimeClock Feb 24, 2026
@g11tech g11tech merged commit 624366e into main Feb 24, 2026
11 of 12 checks passed
@g11tech g11tech deleted the claude/add-timeslot-logging-aBQge branch February 24, 2026 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants