← all notes

deterministic simulation for raft

Normal unit tests rarely catch split-brain or partition edge cases. Replacing wall clocks and real sockets with seeded deterministic simulation lets you inject faults, replay exact seeds, and prove 0-violation invariants.

Raft notes from the same sitting:

  • It works by electing a single leader responsible for accepting client requests and replicating the log to its followers.

  • A log is considered committed when a majority of the cluster accepts it

  • This ensures that system is available as long as more than half of nodes are operational

  • Once leader dies, candidate nodes come up for elections. Randomized election timeouts decide who campaigns first; voters reject candidates whose logs are less up-to-date (Raft §5.4.1).