Skip to main content

simraft-kv

Sans-I/O Raft consensus engine, deterministic chaos simulator, and linearizable key-value store in Rust.

simraft-kv separates consensus logic from all network, disk, and clock I/O. One pure state machine (Node::step) and one checksummed wire codec ("SRKV") power both a single-seed deterministic chaos simulator and a multi-process TCP and file-backed key-value server.

Docs · Architecture · Invariants · Security · Releases

CI on main crates.io version PyPI version docs.rs MSRV 1.88 MIT or Apache-2.0 license

A two-part view with live five-node cluster topology and safety oracle status above and real simraft-sim and simraft-node terminal runs below, sweeping 25 chaos seeds, replaying seed 912 deterministically, running the sans-I/O embed example, and executing linearizable TCP writes and reads

Every terminal line above comes from real runs of simraft-sim, the embed example, and simraft-node.

Why simraft-kv

Distributed consensus bugs hide in rare interleavings of asymmetric partitions, crash recoveries with unpersisted tails, stale durability acknowledgments after log truncation, and corrupted wire frames. Testing Raft only over live sockets makes those interleavings slow to trigger and nearly impossible to replay. simraft-kv makes every transition a pure function of explicit events so thousands of hostile cluster histories can be explored and replayed byte for byte from a single 64-bit integer.

  • Pure sans-I/O consensus core. simraft-core has zero external dependencies, reads no ambient clock or randomness, and emits explicit Action values (Send, PersistHardState, PersistEntries, Apply, ReadReady, ClientResponse, PersistSnapshot, LoadSnapshot) in deterministic order.
  • Complete operational Raft protocol. Implements Pre-Vote elections with leader recency denial (T-03..T-05), Figure 8 commitment (S-06), term-boundary conflict fast backup (S-08), clock-free ReadIndex quorum reads (R-01..R-04), chunked InstallSnapshot transfer (N-01..N-08), and single-server voter and learner membership changes (M-01..M-05).
  • Durability-gated transitions. Votes, append acknowledgments, snapshot responses, single-voter commits, and ReadIndex releases wait until required HardState and log watermarks reach durable storage, clamping watermarks and fencing stale acks across log truncations (T-02, R-06).
  • Per-event safety oracles and Wing and Gong linearizability. simraft-sim checks Election Safety, Leader Append-Only, Log Matching, Leader Completeness, and State Machine Safety after every simulator event, verifies completed client histories with a per-key Wing and Gong linearizability checker, and enforces post-heal leader and state digest convergence (H-02).
  • Shared wire codec across simulator and TCP. simraft-wire frames every peer and client message with "SRKV" magic, 16 MiB defensive bounds, trailing-byte rejection, and IEEE CRC-32 checksums, exercised identically under simulated bit-flips and live sockets.

Four measured and verified simraft-kv metrics showing 1.50 microsecond three-node commit rounds, 0 Tick and 4 single-entry AppendEntries allocations, 100,000 weekly chaos seeds, and S-01 through S-05 safety plus Wing and Gong linearizability checks

How it works

Tick, SRKV peer frames, persist watermarks, and client requests enter the pure sans-I/O simraft-core and simraft-kv state machines over the shared simraft-wire codec, driving both the deterministic simraft-sim chaos harness and the durable TCP simraft-node server

Crate Kind External runtime deps Role
simraft-core library none (std only) Pure sans-I/O Raft state machine (Node::step), Pre-Vote elections, fast log backup, Figure 8 commitment, ReadIndex, chunked snapshots, and single-server membership changes.
simraft-wire library crc32fast Canonical "SRKV" message frame, log entry, and cluster config codec with 16 MiB frame bounds and IEEE CRC-32 checksums.
simraft-kv library none (std only) Deterministic BTreeMap key-value state machine, bounded client session deduplication, and SHA-256 verified snapshot payloads.
simraft-node library and binary clap, crc32fast File-backed durable store, TCP peer transport, serve daemon, and linearizable client CLI (put, get, delete).
simraft-sim library and binary clap, crc32fast, sha2 Single-threaded deterministic simulator, seeded --chaos fault injector, per-event safety oracles, and Wing and Gong linearizability checker.

Quickstart

Install the server and simulator binaries from crates.io, via cargo-binstall and GitHub Releases, or install the simulator CLI and typed Python SDK from PyPI.

cargo install simraft-node simraft-sim
# or install simraft-sim and the Python SDK from PyPI
pip install simraft-kv
import simraft_kv

sweep = simraft_kv.simulate(seed=912, seeds=5, chaos=True)
assert sweep.all_passed

Run a deterministic chaos sweep and replay a single seed

Sweep 25 seeds across asymmetric partitions, crashes, clock jumps, and wire bit-flip corruption, then replay seed 912 deterministically.

simraft-sim --seed 0 --seeds 25 --chaos
simraft-sim --seed 912 --seeds 1 --chaos --json
{"seed":912,"completed":true,"converged":true,"leader_converged":true,"ticks":9292,"verdict":"linearizable","digest":"c8a282578b8f0c97569595cff000063cfa6dfd8f23fc41c6be10f4994bde7095","passed":true}

Run a three-node localhost TCP cluster

Start three simraft-node servers in separate terminals.

simraft-node serve --id 1 --data-dir /tmp/srkv-1 \
  --member 1@127.0.0.1:7001 --member 2@127.0.0.1:7002 --member 3@127.0.0.1:7003

simraft-node serve --id 2 --data-dir /tmp/srkv-2 \
  --member 1@127.0.0.1:7001 --member 2@127.0.0.1:7002 --member 3@127.0.0.1:7003

simraft-node serve --id 3 --data-dir /tmp/srkv-3 \
  --member 1@127.0.0.1:7001 --member 2@127.0.0.1:7002 --member 3@127.0.0.1:7003

Write, read, and delete keys against any member. The client follows leader hints automatically and reads linearizably through ReadIndex.

simraft-node client --server 127.0.0.1:7001 put greeting hello
simraft-node client --server 127.0.0.1:7002 get greeting
simraft-node client --server 127.0.0.1:7003 delete greeting

put and delete print ok and exit 0. get writes raw value bytes to standard output and exits 0 when present, exits 1 with simraft-node: key not found on standard error when absent, and exits 2 on transport, timeout, or cluster errors.

Embed the sans-I/O core in Rust

Callers embedding simraft-core own sockets, storage, and timers while Node::step computes every state transition.

let actions = node.step(event);
for action in actions {
    // Send messages, persist durable state, apply committed entries,
    // or complete client proposals and reads in action order.
}

Run the self-contained single-file three-node embedding example.

cargo run -p simraft-core --example embed --locked

Benchmarks and verification

Measured with the Criterion benchmarks in this repository on hosted runners (2026-11-19 baseline plus v0.2.0 allocation gate).

Benchmark / Gate Workload Median / Bound Throughput / Budget
propose_commit_single Full propose and commit round on a 3-node cluster (32-byte entry) 1.50 us ~668,000 rounds/s
propose_commit_batch_32 Coalesced batch of 32 proposals released on one persist ack (B-02) 85.5 us ~374,000 entries/s
follower_append_entries Follower stepping one AppendEntries RPC 76 ns ~13.1M steps/s
follower_catchup_10k Empty follower catching up to a 10,000-entry leader log 4.06 ms ~2.46M entries/s
step_allocations (L-03) Thread-local heap allocations inside Node::step 0 (Tick), 2 (RequestVote), 4 (AppendEntries) Budgets 4, 4, 7
checker_scale (L-04) Wing and Gong per-key linearizability decision over 100,000 ops across 64 keys 100,000 states Memoized exact verdict

Run the full verification suite locally on Rust 1.88 or newer (CI pins 1.100.0 and checks MSRV 1.88.0 across Linux, macOS, and Windows, plus 1,000 chaos seeds on PRs, 10,000 on main, and 100,000 weekly).

cargo fmt --all -- --check
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
PROPTEST_CASES=500 cargo test --workspace --all-features --locked
RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --locked
cargo bench --workspace --locked -- --test

Documentation

If you want to... Read
Browse every document in the workspace Documentation index
Read the protocol state rules, "SRKV" byte tables, and digest domains Architecture · Decisions
Audit every safety, durability, liveness, and determinism invariant Invariants and traceability matrix
Explore individual workspace crates simraft-core · simraft-wire · simraft-kv · simraft-node · simraft-sim
Check defensive bounds, threat model, and release history Security policy · Roadmap · Changelog

Contributing

CONTRIBUTING.md covers local verification commands, replaying failing chaos seeds, invariant traceability rules, and public copy standards.

License

Licensed under either of MIT or Apache-2.0 at your option.

Metadata

Release files for simraft-kv 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simraft-kv 0.2.0
File Size Uploaded Provenance Actions
simraft_kv-0.2.0.tar.gz 154.4 kB With provenance Details for simraft_kv-0.2.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for simraft-kv 0.2.0
File Actions
simraft_kv-0.2.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for simraft_kv-0.2.0-py3-none-win_amd64.whl
simraft_kv-0.2.0-py3-none-manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64 Details for simraft_kv-0.2.0-py3-none-manylinux_2_28_x86_64.whl
simraft_kv-0.2.0-py3-none-manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.28+ ARM64 Details for simraft_kv-0.2.0-py3-none-manylinux_2_28_aarch64.whl
simraft_kv-0.2.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for simraft_kv-0.2.0-py3-none-macosx_11_0_arm64.whl
simraft_kv-0.2.0-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details for simraft_kv-0.2.0-py3-none-macosx_10_12_x86_64.whl

Total release size: 3.3 MB

Release files / simraft_kv-0.2.0.tar.gz

Download URL simraft_kv-0.2.0.tar.gz
Size 154.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b0afee700682f51c5e97851311d9681df479ff916e3dc5f43741def9a01356ac
BLAKE2b-256 checksum
How to use checksums
c4360dae6cbe1dfd6b85530a74d0608609be71883283875677b47c579f233d17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / simraft_kv-0.2.0-py3-none-win_amd64.whl

Download URL simraft_kv-0.2.0-py3-none-win_amd64.whl
Size 593.5 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
267c5948f9042d43b8327d3fa2ac88ec143611163cc4a8b345e331a6421f0e5a
BLAKE2b-256 checksum
How to use checksums
732fadfd50efb5a6dbab414d1758a43c3b0d3633441ed9627a3c76a5237e5634
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / simraft_kv-0.2.0-py3-none-manylinux_2_28_x86_64.whl

Download URL simraft_kv-0.2.0-py3-none-manylinux_2_28_x86_64.whl
Size 683.3 kB
Tags Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
4fc8b75a8362ee84acf2b84c170ab9291723832a276526637d9f0ea7c3e3d926
BLAKE2b-256 checksum
How to use checksums
6f136fb0209b103b37433675dace124fa38a149da6574c5c990c64840971c2e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / simraft_kv-0.2.0-py3-none-manylinux_2_28_aarch64.whl

Download URL simraft_kv-0.2.0-py3-none-manylinux_2_28_aarch64.whl
Size 635.7 kB
Tags Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
862f6cdae09b1da1d9a38282b3cfea42704710fa8f51ce9e34c7647ca3de5eb9
BLAKE2b-256 checksum
How to use checksums
aab06d3db414fec5a6fedda047bdb3018bde22cc40b4a8d2e64d8e862299d74d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / simraft_kv-0.2.0-py3-none-macosx_11_0_arm64.whl

Download URL simraft_kv-0.2.0-py3-none-macosx_11_0_arm64.whl
Size 596.5 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0361729c54c100c3ac49beb4453760bc8d2af4ecad63dd4828149ec2c3eec8af
BLAKE2b-256 checksum
How to use checksums
52421224f4dd881b593e37c04b3db8e5c2e04e45425717e198c6728b1acd5e56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / simraft_kv-0.2.0-py3-none-macosx_10_12_x86_64.whl

Download URL simraft_kv-0.2.0-py3-none-macosx_10_12_x86_64.whl
Size 669.5 kB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
ff4e667b0868e216a75af2d30f522b60ed7558f546916fe7376b75f4a03130e0
BLAKE2b-256 checksum
How to use checksums
c1f4c8ab9f7d6e014720138ff31b7da89deb0aa785b463064aedd76b9e523350
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Security for simraft-kv 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for simraft_kv-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

6 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page