add slot/interval context to log timestamps via SlotTimeClock#602
Merged
add slot/interval context to log timestamps via SlotTimeClock#602
Conversation
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
approved these changes
Feb 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 SlotTimeClockfield (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_clockis pointed atchain.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