Skip to content

Commit 4b3576b

Browse files
committed
ci: add translation of a Keccak example file
1 parent 95df30e commit 4b3576b

File tree

7 files changed

+1190
-8
lines changed

7 files changed

+1190
-8
lines changed

.github/workflows/rocq.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,33 @@ jobs:
2626
custom_image: coqorg/coq:8.17-ocaml-4.14-flambda
2727
custom_script: |
2828
startGroup "Install dependencies"
29+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
30+
source "$HOME/.cargo/env"
31+
cargo --version
2932
sudo ln -s `which python3` /usr/bin/python
3033
opam install -y --deps-only RocqOfNoir/rocq-of-noir.opam
3134
endGroup
3235
startGroup "Change permissions"
3336
sudo chown -R $(whoami) .
3437
endGroup
38+
startGroup "Generate JSON representation"
39+
cargo install --path tooling/nargo_cli
40+
cd noir_stdlib
41+
nargo test hash::keccak::tests::smoke_test --show-monomorphized
42+
cd ..
43+
endGroup
3544
startGroup "Convert to Rocq"
45+
python scripts/rocq_of_noir.py noir_stdlib/monomorphized_program.json >RocqOfNoir/keccak_monomorphic.v
3646
python scripts/rocq_of_noir.py RocqOfNoir/base64/monomorphized_program.json >RocqOfNoir/base64/monomorphic.v
3747
endGroup
38-
startGroup "Check that the diff is empty (excluding submodules)"
39-
git -c color.ui=always diff --exit-code --ignore-submodules=dirty
40-
endGroup
4148
startGroup "Compile Rocq translations"
4249
cd RocqOfNoir
4350
make
4451
cd ..
4552
endGroup
53+
startGroup "Check that the diff is empty (excluding submodules)"
54+
# We remove these files as the generation is not yet deterministic
55+
rm noir_stdlib/monomorphized_program.json
56+
rm RocqOfNoir/keccak_monomorphic.v
57+
git -c color.ui=always diff --exit-code --ignore-submodules=dirty
58+
endGroup

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
# ◼️🐓 rocq-of-noir
22

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! 🛡️
44

55
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!
66

77
## 🏎️ Getting Started
88

9+
1. Install the `rocq-of-noir` fork of the Noir compiler:
10+
11+
```bash
12+
```
13+
914
Follow what we do in our CI file [rocq.yml](.github/workflows/rocq.yml). Sorry for not having the time to provide more explanations!
1015

1116
## ✅ What Works

RocqOfNoir/RocqOfNoir.v

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,9 @@ Module M.
290290
(at level 100).
291291

292292
Notation "[[ e ]]" :=
293-
(ltac:(M.monadic e))
293+
(* (ltac:(M.monadic e)) *)
294294
(* Use the version below for debugging and show errors that are made obscure by the tactic *)
295-
(* (M.pure e) *)
295+
(M.pure e)
296296
(only parsing).
297297
End Notations.
298298
Import Notations.
@@ -508,12 +508,18 @@ Export M.Notations.
508508

509509
Parameter get_function : forall (name : string) (id : Z), Value.t.
510510

511+
Parameter get_global : forall (name : string) (id : Z), Value.t.
512+
513+
Parameter get_low_level : forall (name : string), Value.t.
514+
511515
Definition closure (definition : list Value.t -> M.t) : Value.t :=
512516
Value.Closure (existS (Value.t, M.t) definition).
513517

514518
Module Builtin.
515519
Parameter __to_be_radix : Value.t.
516520

521+
Parameter __to_le_radix : Value.t.
522+
517523
Parameter as_bytes : Value.t.
518524

519525
Parameter assert_constant : Value.t.

0 commit comments

Comments
 (0)