hn.today

Verifying formal models of Raft implementations

antithesis.com4 points0 comments
Screenshot of Verifying formal models of Raft implementations

The work applies AI-assisted formal verification to production implementations of Raft from HashiCorp and etcd. Although both libraries implement the same consensus protocol, their concurrency, data structures, and extensions differ from the assumptions in Raft’s original proof. The team used Claude to infer TLA+ models from the code, then manually guided which features and scenarios to include. The models cover features such as pre-votes, snapshots, and leadership transfers; the etcd model also includes read indexes, asynchronous storage writes, and membership changes. They express Raft’s core safety guarantees: one leader per term, consistent logs, preservation of previously committed entries, and agreement among nodes on applied entries.

Verification combined exhaustive model checking of bounded cluster scenarios, mathematical proofs in Lean and TLAPS, and Antithesis testing under generated workloads and injected failures. Structured runtime traces were checked against model transitions, exposing either instrumentation or modeling gaps, or implementation bugs. Repeated cycles of checking, testing, model refinement, and code fixes produced seven patches across the libraries, including fixes for known issues and newly identified bugs. The final proofs establish safety for the modeled designs, but do not prove the code itself correct; confidence in the models’ connection to the implementations comes from trace validation and testing. The project illustrates how these techniques can uncover subtle defects and support proofs beyond the small cases model checking can explore, while remaining limited to the features represented in the models.

Read on antithesis.com0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.