You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you're trying to analyze Solidity smart contracts with symbolic execution, check out our guide for Kontrol at [docs.runtimeverification.com/kontrol].
5
+
4
6
We assume that KEVM is installed, and the [K tutorial] has been completed.
5
7
This document provides instructions for kompiling and running claims using KEVM.
6
8
7
9
In `tests/specs/examples`, you can find a few examples to get you started on proving with kevm.
8
10
9
-
Example 1: Sum to N
10
-
-------------------
11
+
Example: Sum to N
12
+
-----------------
11
13
12
14
Have a look at the [sum-to-n-spec.k] file.
13
15
It has two modules:
@@ -18,95 +20,52 @@ It has two modules:
18
20
The first step is kompiling the `.k` file with the below command.
-`solc-to-k` will parse a Solidity contract and generate a helper K module.
55
-
-`--main-module` is used to set the name of the module.
41
+
Debugging a proof
42
+
-----------------
56
43
57
-
The generated `erc20-bin-runtime.k` file contains K rules and productions for the contract’s bytecode, storage indexes for the state variables, and function selectors, among others.
58
-
These rules are then used in the claims. As an example, the `#binRuntime(ERC20)` production, which is found in the `<program>` cell, will rewrite to `#parseByteStack (contractBytecode)`, parsing the hexadecimal string into a `ByteStack`.
44
+
For `kevm prove-legacy`, you can use the `--debugger` flag to debug a proof. With it, you can use `step`/`stepf` to navigate through the rewrite steps and `konfig` to display the K configuration. You can see all the available commands using `help`.
59
45
60
-
Following this, we can compile the Markdown file with:
In addition to this, you can use `kevm show-kcfg ...` or `kevm view-kcfg ...` to get a visualization.
46
+
For `kevm prove`, you can use `kevm show-kcfg ...` or `kevm view-kcfg ...` to get a visualization.
47
+
***Note:*** this is not compatible with `kevm prove-legacy`.
90
48
91
49
`kevm view-kcfg [spec_file] [--save-directory save_directory] [--claim claim_label] ...` command takes the same basic arguments as `kevm prove ...` does, including:
92
-
-`spec_file` is the file to look in for specifications. This file is read like with `kevm prove —pyk …`; the `KProve.get_claims` invokes the frontend.
93
-
-`--save_directory` must be passed as where the KCFGs have been saved (by a previous call to `kevm prove --save-directory save_directory ...`
94
-
-`--claim claim_label`option is added, but unlike the `kevm prove ...`, you can only repeat it once. This option lets you select an individual claim out of the `spec_file`; if not supplied, it’s assumed that only one spec is present.
50
+
-`spec_file` is the file to look in for specifications. This is the same file that is used for `kevm prove …`.
51
+
-`--save-directory` must be passed as where the KCFGs have been saved (by a previous call to `kevm prove --save-directory save_directory ...`)
52
+
-`--claim claim_label` lets you select an individual claim out of the `spec_file`. If the flag is ommited, it’s assumed that only one claim is present. If the flag is ommited and more than one claim is present in the `spec_file` then an error will be raised.
95
53
-`--spec-module spec_module` is also an inherited option.
96
54
97
55
The interactive KCFG (`view-kcfg`) puts your terminal in *application mode*. To select text in this mode, hold the modifier key provided by your terminal emulator (typically SHIFT or OPTION) while clicking and dragging. Refer to the [Textualize documentation](https://github.com/Textualize/textual/blob/main/FAQ.md#how-can-i-select-and-copy-text-in-a-textual-app) for more information.
98
56
57
+
`kevm show-kcfg [spec_file] [--save-directory save_directory] [--claim claim_label] ...` command is pretty similar, but prints out the K Control Flow Graph to `stdout` instead.
0 commit comments