Skip to main content

Module determinism_guard

Module determinism_guard 

Source
Expand description

Determinism guard: trap handlers for clock, randomness, and thread spawn in Replay/Verify.

When the kernel is in crate::kernel::kernel_mode::KernelMode::Replay or crate::kernel::kernel_mode::KernelMode::Verify, these traps immediately fail execution if code attempts clock access, hardware randomness, or uncontrolled thread spawning, so the same run guarantees an identical event stream.

Structs§

DeterminismGuard
Guard that enforces determinism in Replay/Verify mode.

Functions§

compute_event_stream_hash
Computes SHA-256 hash of the canonical serialized event sequence.
event_stream_hash
Computes a deterministic SHA-256 hash of the event stream for a run.
verify_event_stream_hash
Verifies that the current event stream for run_id matches expected_hash. Returns Err if the hash does not match (replay mismatch).