This repo contains scripts and examples for testing CertiCoq-Wasm.
- CertiCoq-Wasm (installation)
- Node.js (installation, version 22 or higher)
- wasm-tools (cargo install wasm-tools)
# Check the setup
git clone https://github.com/womeier/certicoqwasm-testing
cd certicoqwasm-testing/examples/certicoqwasm && make
For some small examples see foo.v
, sha.v
and the Makefile in examples/certicoqwasm/
.
Compiling each Coq file generates a .wasm
file that can be run with e.g. Node.js, run make help
to see how.
The JavaScript files specify pretty-printing the result. For Coq's most common types we have pp functions in evaluation/pp.js
, see sha.js
on how to use.
The generation of pp functions is not yet automated, the reader is welcome to create an issue for help.
(We currently use CertiCoq-Wasm's debugging
branch and CertiCoq Generate Wasm -debug
to get the constructor environment,
and the constructors' ordinals, they're the same as with CertiCoq's C backend.)
Note that a package.json
may be required for JavaScript imports.
- wabt (apt install wabt)
- binaryen (nix profile install nixpkgs#binaryen, version 117 or higher)
- wasmtime (nix profile install nixpkgs#wasmtime, most recent version, at least version 18)
- python bindings for wasmtime (pip install wasmtime, must be same version as wasmtime)
# in evaluation/
./benchmark.py --engine=node --folder ./binaries/non-cps-cleanup-oct-13-24 --wasm-opt -O2
./benchmark.py --help
More evaluation
- Create branch in main repo
benchmarks_<NAME>
- Create folder with name
<NAME>
in./evaluation/binaries/
, put binaries in it - Insert folder with short description in
./evaluation/benchmark.py
, possibly update program list - Then you can run the benchmark as described above.
- Add the expected result in file in
./evaluation/results
- Run the
./evaluation/sanity-checks.py
script.
To evaluate the extraction via Rust (more information), run the following in evaluation/rust_to_wasm/
:
./benchmark.py --folder ./binaries/unchecked_arith/
To evaluate the extraction via OCaml (more information), run the following in evaluation/ocaml_to_wasm/
:
./benchmark.py --folder ./binaries/
To evaluate the extraction via C and emscripten (more information), run the following in evaluation/c_to_wasm
:
./benchmark.py --folder ./binaries/
To evaluate the extraction via Malfunction (more information), run the following in evaluation/malfunction_to_wasm
:
./benchmark.py --folder ./binaries/
In demo_website_sha256/
, start dev-browser by:
make develop
In demo_blockchain_smartcontract/
, run some tests (more information) for the smart contract counter
by:
make run-concordium-test
- Small Wasm example programs in
examples/wasm/
- Small WasmCert example proofs in
examples/wasmcert/
(including a scriptwasm_to_coq.py
to import .wasm file to Coq)