d-xo / klab-init

Klab template and small tutorial

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Klab Starter Pack

This is a template repo and list of resources for those interested in getting started specifying smart contracts with klab.

klab is a smart contract specification language and proof explorer. A Klab spec can be thought of as an extremely thorough test suite that can be run against any evm bytecode.

Using klab we can show:

  • The spec covers every possible execution (is exhaustive)
  • All specified behaviours hold for every possible execution

Building Klab

  1. Clone the klab repo (git@github.com:dapphub/klab.git)
  2. From the repo root run nix-shell
  3. Run make deps
  4. Run make deps-haskell
  5. Klab is now available in your path

In future when you need to use klab you can go to the repo root, run nix-shell and you will be dropped into a shell with klab available on PATH.

Learning Klab

  1. Read the documentation on the spec format
  2. Play around with the examples
  3. Watch @mrchico's talk
  4. Look at the keybindings
  5. Work through the DevCon4 workshop: problems, solutions

Working With This Repo

Writing Implementations

This repo uses dapp to handle solidity related tasks. You can build with dapp build and run tests with dapp test.

Writing Specs

  1. Open spec/spec.act.md and start writing your spec
  2. Ensure that the mapping from specs to implementations in config.json is up to date
  3. Build the k expressions (klab build)

Verifying a Single Spec

  1. Run klab prove --dump <path_to_spec.k>

Verifying All Specs

  1. Run klab prove-all

Exploring Proofs

  1. Run klab debug $(klab hash <path_to_spec.k>)

About

Klab template and small tutorial

License:GNU Affero General Public License v3.0


Languages

Language:GCC Machine Description 95.9%Language:Makefile 4.1%