From 754cf9ae3b3c03f92547693d5fe85d6403c812a9 Mon Sep 17 00:00:00 2001 From: Oleksandr Pravdyvyi Date: Wed, 25 Sep 2024 12:34:46 +0300 Subject: [PATCH] zkWASM instructions added --- README.md | 6 +++ zkwasm/README.md | 48 +++++++++++++++++++ .../scripts_and_tools/zkwasm_setup_circuit.sh | 3 +- 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 zkwasm/README.md diff --git a/README.md b/README.md index 4a6fff0..71a3d55 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,8 @@ # nescience-zkvm-testing This repo reflects the tests conducted by Nescience Team on selected zkVMs. + +# How to run tests + +To run test, corresponding to zkVM of choise read + +[zkWASM](./zkwasm/README.md) diff --git a/zkwasm/README.md b/zkwasm/README.md new file mode 100644 index 0000000..7d86478 --- /dev/null +++ b/zkwasm/README.md @@ -0,0 +1,48 @@ +# Test run instructions + +To run corresponding tests in `zkWASM` some preparations have to be done. + +We assume, that one is in `zkwasm` folder. + +Firstly, move into [scripts_and_tools](./scripts_and_tools/) directory. + +Next, run + +```sh + ./zkwasm_setup.sh +``` + +This will create `zkWasm` folder with sorce code and attempt to build it. + +Next, to prove execution we need to build one of the tests, let`s use [simple_arithmetic_test](./tests/simple_arithmetic_test/) as an example. + +Run + +```sh + ./zkwasm_build.sh ../tests/simple_arithmetic_test +``` + +If run is succsessfull then you will see `output.wasm` file in the test directory. + +Next, we need to setup proving circuit, to do so, run + +```sh + ./zkwasm_setup_circuit.sh ../../tests/simple_arithmetic_test/output.wasm 18 +``` + +Note, that testing executed from the `zkWasm` directory, thus path have to be relative to it, or global. + +Note, that second parameter (18) is a size of a circuit. Bigger executables will need bigger circuit sizes to be proven. + +Now, that circuit is built, we can prove execution as follows + +```sh + ./zkwasm_prove.sh ../../tests/simple_arithmetic_test/output.wasm +``` + +If needed, proof can be verified as follows + +```sh + ./zkwasm_verify.sh ../../tests/simple_arithmetic_test/output.wasm +``` + diff --git a/zkwasm/scripts_and_tools/zkwasm_setup_circuit.sh b/zkwasm/scripts_and_tools/zkwasm_setup_circuit.sh index 2591bc5..6f7be17 100755 --- a/zkwasm/scripts_and_tools/zkwasm_setup_circuit.sh +++ b/zkwasm/scripts_and_tools/zkwasm_setup_circuit.sh @@ -1,5 +1,6 @@ WASM_PATH=$1 +CIRCUIT_SIZE=$2 cd zkWasm -cargo run --release -- --params params testwasm setup --host standard -k 18 --wasm $WASM_PATH +cargo run --release -- --params params testwasm setup --host standard -k $CIRCUIT_SIZE --wasm $WASM_PATH cd .. \ No newline at end of file