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
Copy file name to clipboardExpand all lines: README.md
+28-2Lines changed: 28 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,38 @@
1
1
# ◼️🐓 rocq-of-noir
2
2
3
-
With `rocq-of-noir`, we provide an **open-source and extensive way to formally verify smart contracts written in ⬛ Noir**. Formal verification is about checking for any possible input that your code has no security issues, what is essential for code deployed on the blockchain! 🛡️
3
+
The tool `rocq-of-noir` provides an **open-source and extensive way to formally verify smart contracts written in ⬛ Noir**. Formal verification is about checking for any possible input that your code has no security issues, what is essential for code deployed on the blockchain! 🛡️
4
4
5
5
To keep things simple, we rely on the well-known proof assistant [Rocq](https://rocq-prover.org/) for all the verification work: if you are already knowledgeable into this system, you can readily use `rocq-of-noir` to verify your smart contracts!
6
6
7
7
## 🏎️ Getting Started
8
8
9
-
Follow what we do in our CI file [rocq.yml](.github/workflows/rocq.yml). Sorry for not having the time to provide more explanations!
9
+
1. Install the `rocq-of-noir` fork of the Noir compiler:
10
+
```sh
11
+
cargo install --path tooling/nargo_cli
12
+
```
13
+
2. Translate an example to JSON representation. Here, we translate the test for the Keccak hash function, which includes the code of the hash function itself:
14
+
```sh
15
+
cd noir_stdlib
16
+
nargo test hash::keccak::tests::smoke_test --show-monomorphized
17
+
cd ..
18
+
```
19
+
Note that the translation to JSON is what our fork of the Noir compiler provides. This is the AST of the code after the monomorphization phase.
The file `RocqOfNoir/keccak_monomorphic.v` is the Rocq representation of the Noir code!
25
+
4. Compile the Rocq code:
26
+
```sh
27
+
cd RocqOfNoir
28
+
make
29
+
```
30
+
31
+
To see an example of verification work, you can look at the `base64` example in the folder [RocqOfNoir/base64](RocqOfNoir/base64). We follow these steps:
32
+
33
+
- Show that the monomorphized code is correct is equivalent to a polymorphic form where we keep the generic types. This removes the duplication of some functions, and makes sure that names are more stable (no more generated indexes to distinguish between the various function instanciations).
34
+
- Show that the polymorphic code is equivalent to a purely functional definition applying the semantic rules defined in [RocqOfNoir/proof/RocqOfNoir.v](RocqOfNoir/proof/RocqOfNoir.v).
35
+
- Express and prove properties using the usual techniques on functional and monadic Rocq code!
0 commit comments