Deterministic Simulation Testing in Rust: A State Machine Approach
2025-08-05
The Polar Signals team shares their experience building a new Rust database with a state machine architecture that puts deterministic simulation testing (DST) front and center. Unlike their previous Go database, FrostDB, the new database eschews controlling the existing scheduler and instead uses a state machine model where all core components are written as single-threaded state machines communicating via a message bus. This approach provides complete control over concurrency, time, randomness, and failure injection, greatly simplifying DST implementation and uncovering two critical bugs. While this approach demands extra cognitive overhead, it results in more precise reasoning about system behavior and more reliable code.