Giter VIP home page Giter VIP logo

raft-spin's Introduction

Formally verified Raft in SPIN

This is a formally verified Raft specification in SPIN, as a course project of Software Formal Verification, 2020 Autumn, Tsinghua University.

This main references of this work are the Raft paper, PhD dissertation of Diego Ongaro and TLA+ formal model of Raft.

Here is the technial report (in Chinese).

Requirements

  • Model checker: SPIN (~6.5.1)

A large memory space is needed to run.

For Linux, it's recommended to unlimit the memory of process by the following way:

ulimit -s unlimited

Verification

As it takes a long time to verify all properties together, it's better to verify each property separately.

The following command is recommended:

$ spin -run -a -bit -bcs -n [-noclaim | -ltl p] raft.pml

The interpretation of the used parameters:

  • -run: model check rather than simulate.
  • -a: inspect acceptance cycles, which is needed for verifying LTL properties.
  • -bit: store states by bit, to save space cost.
  • -bcs: use bounded-context-switching algorithm to speed up.
  • -n: close the output of unreachable states. Because we verify each property seperately, other unverified properties will generate many unreachable states. Thus, we need to close the output of these many unreachable states.

The followings are the verification commands for all 6 properties in the Raft paper. The total time to run all commands is about 1 hour.

Deadlock (invalid end state)

$ spin -run -a -bit -bcs -n -noclaim raft.pml

Election Safety

$ spin -run -a -bit -bcs -n -ltl electionSafety raft.pml

Leader Append-Only (As this property is too complicated, we decompose it into 6 sub-properties. The valid of original property is equivalent to the valid of all 6 sub-properties.)

$ spin -run -a -bit -bcs -n -ltl leaderAppendOnly00 raft.pml
$ spin -run -a -bit -bcs -n -ltl leaderAppendOnly01 raft.pml
$ spin -run -a -bit -bcs -n -ltl leaderAppendOnly10 raft.pml
$ spin -run -a -bit -bcs -n -ltl leaderAppendOnly11 raft.pml
$ spin -run -a -bit -bcs -n -ltl leaderAppendOnly20 raft.pml
$ spin -run -a -bit -bcs -n -ltl leaderAppendOnly21 raft.pml

Log Matching

$ spin -run -a -bit -bcs -n -ltl electionSafety raft.pml

Leader Completeness

$ spin -run -a -bit -bcs -n -ltl electionSafety raft.pml

State Machine Safety

$ spin -run -a -bit -bcs -n -ltl electionSafety raft.pml

raft-spin's People

Contributors

namasikanam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

kikimo wizmann

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.