Antithesis proves Raft safety properties for models of etcd-raft and HashiCorp Raft

Antithesis proves Raft safety properties for models of etcd-raft and HashiCorp Raft

Antithesis, which says it loves finding bugs in distributed systems, has published a write-up of how it combined AI and formal methods to prove design-level correctness for two production Raft libraries: etcd-raft and HashiCorp Raft. The two implement the same protocol but take significantly different approaches. The team used AI, TLA+ and Antithesis to model both libraries with trace validation, then looped between model checking, Antithesis testing and proof attempts. Each of those exposed either bugs in the code or gaps in the model. The team patched the bugs and refined the model until it was provable and every test run conformed.

The model covers several extensions to core Raft: pre-votes, snapshots and leadership transfers. For etcd-raft only, it also covers read indexes for linearizability, async storage writes and membership changes, where etcd's implementation intentionally deviates from the Raft paper. The final proofs establish core Raft safety properties such as Election Safety, Leader Completeness and State-Machine Safety. The authors conclude that, once the workarounds and fixes were applied, the specific designs in HashiCorp Raft and etcd-raft (scoped to the modeled features) offer the same guarantees as the Raft paper. They say the artifacts are available for open review.

The motivation comes from an earlier Antithesis post saying it keeps finding bugs in every major Raft implementation it tests, even though the Raft protocol itself has been extensively studied and proven correct under a set of assumptions. Implementations tend to deviate from those assumptions, redesign the algorithm for performance, or add unverified extensions. Antithesis argues that advances in AI have made automated theorem proving and formal verification of complex systems far more scalable, so connecting a specification to its implementation is now feasible.

The approach has several steps. Claude Fable 5.2 inferred TLA+ models automatically from the code of both libraries, and the authors then manually reviewed the safety properties declared in the specifications. They also had to guide the agent by hand on which features to model or leave out and which scenarios to model check, and they made one refinement to the auto-generated safety properties. They say AI is generally bad at inferring properties, so here the agent was simply told to express the core safety properties from the Raft paper. Those are Election Safety (at most one leader per term), Log Matching (logs that share an entry at an index and term agree on everything up to it), Leader Completeness (a leader's log contains every entry committed in earlier terms) and State Machine Safety (no two nodes apply different entries at the same index; the state machine itself is not modeled).

To check that the model matches the software, the team used the recently launched Antithesis plugin to set up a test cluster, a workload that exercises every modeled feature, and assertions matching the safety properties. The software ran under fault injection with random inputs. A lightweight trace validation kit let it emit structured log events corresponding to TLA+ state transitions. Any run whose trace did not fit some path in the model was flagged. That could mean bad instrumentation, a modeling error or a real bug, and the AI agent was told to work out which and keep iterating until traces and model converged.

Before attempting proofs, the team checked the invariants on bounded instances with TLC, the standard TLA+ model checker. The instances, also synthesized by the agent, were small: usually three nodes, a single client value, a couple of terms of leader election, logs of a few entries and only a handful of in-flight network messages. Even so, they produce competing elections, a deposed leader still replicating, overwritten and re-replicated log entries, and crashes mid-operation. The team also checked configurations with pre-vote and snapshotting on and off. The "small" instances can reach over 1.6 million states, which TLC explores exhaustively; some larger problems were only checked by random simulation. If model checking found a violation, the team tried to reproduce it as an assertion failure locally or in Antithesis, and if the software could not show the behavior, the model had to be tightened.

Along the way the team found bugs in both systems. These include previously known open issues (hashicorp/raft#695 and etcd-io/raft#551) and new ones (hashicorp/raft#746 and etcd-io/raft#558). In Antithesis's internal repository it applied 7 patches in total across the two implementations, each time aiming to make the system and model pass both verification and validation. It also hit a few additional crash bugs that do not violate safety.

Bounded model checking only shows the absence of bugs in a small state space, so the team moved to proofs for unbounded sizes. It used two routes: TLAPS, the theorem prover integrated into TLA+, and Veil, a Lean library for modeling state-transition systems, with Claude Fable 5.2 building the proofs. The Lean route used Veil's official tla-to-veil LLM skill, validated by bounded equivalence checking with TLC and Veil's own model checker on the stored instances. The authors say TLAPS would ideally give the best assurance, since it attests to properties on the TLA+ model itself. They started with Lean because the process was highly iterative, and they liked Lean's interactive tactics, predictable performance and persistent kernel-checked proof terms. In one case a model of etcd-raft's membership change as implemented could not be proven correct. That exposed a complex bug whose trigger was beyond the state space bounded model checking explores, and the Antithesis plugin could then try to synthesize a workload to reproduce the counterexample. Antithesis also sped up proof work: Claude proposed intermediate invariants and checked them against test runs, discarding any that failed run-time assertions. Once the properties were fully provable in Lean and the model passed trace validation, the specification was frozen and agents re-proved the same invariants directly on the TLA+ spec with TLAPS. The authors say this last step was not strictly necessary but removed any shadow of doubt about the Lean proofs and the TLA+ spec.

The company puts the cost of the work on each library, end to end, at less than $1,200 in Claude Fable tokens and approximately 2000 Antithesis compute-hours. It adds that this is less than the prepaid allowance in a single month of Antithesis Teams.

The authors stress the limit: the final proofs verify formal models of the implementation, not the code itself. Confidence in the model's fidelity comes from trace validation under Antithesis's test coverage, including network partitions and node crashes. They also ran several rounds of mutation testing: mutating the specification to check that proofs fail, mutating stored test logs to check that trace validation fails, and mutating the software to check that everything breaks. The crawled text of the post ends partway through the next section.

Key facts

  • Antithesis used Claude Fable 5.2, TLA+, Lean/Veil, TLAPS and its testing platform to model etcd-raft and HashiCorp Raft and prove core safety properties (Election Safety, Leader Completeness, State-Machine Safety) for the modeled designs.
  • The proofs verify formal models of the implementations, not the code itself; fidelity rests on trace validation under fault injection such as network partitions and node crashes.
  • Bugs found include known issues hashicorp/raft#695 and etcd-io/raft#551 and new ones hashicorp/raft#746 and etcd-io/raft#558; 7 patches were applied in Antithesis's internal repository across the two implementations.
  • Bounded TLC checks used clusters of usually three nodes and reached over 1.6 million states; a membership-change bug in etcd-raft surfaced only because the proof could not be completed.
  • Antithesis says each library cost less than $1,200 in Claude Fable tokens and approximately 2000 Antithesis compute-hours end to end.

Why it matters

Raft is well proven as a protocol, but production libraries deviate from the paper through performance redesigns and unverified extensions. Antithesis argues AI has made it feasible to connect a specification to a real implementation, and it demonstrates that on etcd-raft and HashiCorp Raft. It also compares its approach with other work. Anthropic/Theorem's OSS-Verify and Google DeepMind's AlphaProof Code, it says, only model single-threaded assembly code, while distributed systems are concurrent. The Specular project produced etcd-raft and hashicorp-raft models built for trace validation, not ease of proof, and the TLAPS leaderboard shows them unsolved as of 20 Nov 2026. Antithesis says its models are meant to be more general and to prove safety of the full design.

Who it affects

Engineers who build or depend on distributed systems, especially those using etcd-raft or HashiCorp Raft, are the most direct audience. The post's findings also concern anyone writing formal specifications, since it shows an AI-assisted workflow that mixes TLA+, Lean and runtime testing. The bugs it reports sit in the etcd and HashiCorp Raft issue trackers.

How to use it

The post is a demonstration of a workflow rather than a product release, though it relies on Antithesis tooling. The loop is: have an AI infer a TLA+ model from the code; review the safety properties by hand; model check bounded instances with TLC; use the Antithesis plugin and a trace validation kit to confirm that real runs conform to the model; patch bugs and refine the model; then prove the invariants in Lean via Veil's tla-to-veil skill and optionally re-prove them with TLAPS. The authors say they make the artifacts available for open review. They also priced the work: less than $1,200 in Claude Fable tokens and approximately 2000 Antithesis compute-hours per library, which they say is less than the prepaid allowance in a single month of Antithesis Teams.

How solid is it

The claims come from Antithesis itself, a company that sells the testing platform it uses here. The authors offer specifics: named issue numbers, bounded state spaces explored exhaustively by TLC, kernel-checked Lean proofs, a TLAPS re-proof, and mutation testing of the spec, the logs and the software. They say the TLAPS step was not strictly necessary. They also say they had to guide the agent manually on feature scope and model checking scenarios, and refined the auto-generated safety properties once. The crawled text is cut off before the end of the article.

Risks and caveats

The authors state plainly that the final proofs verify formal models of the implementation, not the code itself. Fidelity is supported by trace validation, not proven. The conclusions are scoped to the modeled features: membership changes, read indexes and async storage writes are modeled for etcd-raft only, and the state machine itself is not modeled. The 7 patches were applied in Antithesis's internal repository. Bounded model checking only shows the absence of bugs in a small state space, which is why the proofs were needed, and the etcd-raft membership-change bug had a trigger beyond what bounded checking explores. A few additional crash bugs were found that do not violate safety.