Skip to content
case file #005

2026 · Author

Chronoscope

A deterministic simulation testbed, and a Raft-replicated write-ahead log built inside it to be broken on purpose.

Shipped

Problem

why this exists

Consensus and storage bugs hide in rare interleavings of network, disk and clock events. Real clusters can't replay them; a deterministic simulator can, bit for bit, from a seed.

Architecture

napkin sketch, cleaned up
  1. Seedone PRNG
  2. chrono-simvirtual clock · net · disk
  3. chronologRaft + WAL
  4. Oraclelinearizability · liveness
  5. BUGS.md18 found

chrono-sim virtualises the network, disk, clocks and thread interleaving behind traits, driven by one seeded PRNG on a single thread. chronolog, a real Raft-replicated, crash-consistent log, is written against those traits — so the same code runs in the simulator and on real hardware.

Technical decisions

and the trade-offs
  • Never name a socket

    chronolog never touches a socket, file descriptor, clock or thread directly, so the simulator can swap all of them.

  • Check behaviour, not code paths

    A linearizability and liveness oracle decides whether a run was correct.

Key engineering challenges

the bruises
  1. 1

    Bit-for-bit reproduction

    Given a seed, a failing run replays exactly — which is what makes a consensus bug fixable.

  2. 2

    Fix with proof

    Every fix carries a regression test that reproduces the original seed.

Results

  • ✔ 18 real consensus and storage bugs found, 16 fixed, each with a regression test
  • ✔ 86.7 simulated node-hours in 95.07 s of wall clock (3,282×)
  • ✔ After the fixes, 200 of 200 seeds run 400 simulated seconds without a failure
  • ✔ 17.3k lines of Rust, 203 tests

Learnings

  • ✎ Raft on paper and Raft under a hostile scheduler are different algorithms.
  • ✎ A seed you can replay turns a heisenbug into an ordinary one.