diff --git a/vendor/zkllvm-metacraft-circuits/docs/compute_shuffled_index.md b/vendor/zkllvm-metacraft-circuits/docs/compute_shuffled_index.md new file mode 100644 index 000000000..90cd9c8a2 --- /dev/null +++ b/vendor/zkllvm-metacraft-circuits/docs/compute_shuffled_index.md @@ -0,0 +1,17 @@ +# Compute shuffled index documentation. + +### *Implementation* + The implementation code of the circuit is under "DendrETH/vendor/zkllvm-metacraft-circuits/src/circuits_impl/". + This code is used in both the compilation as circuit and as executable. + +### *Circuit build* + In order to build as circuit, we need an entry point marked with the `[[circuit]]` directive. This is done through a wrapper + that uses the implementation code and resides in "DendrETH/vendor/zkllvm-metacraft-circuits/src/circuits". Since currently the Crypto3 + library does not implement computation of sha256 on a byte buffer, we use a header only library for the sha256 computations, which has + negative performance consequences. + +### *Executable build + tests* + The implementation code of the circuit is compiled as executable and tested against the input data from + https://github.com/ethereum/consensus-spec-tests.git. The tests reside in "DendrETH/vendor/zkllvm-metacraft-circuits/src/tests/compute_shuffled_index_test/". + For convenience, we have a script that performs all necessary steps to run the test -> "DendrETH/vendor/zkllvm-metacraft-circuits/scripts/compile_and_run_tests.sh". + It is required that docker is installed on the machine that will run the tests. \ No newline at end of file diff --git a/vendor/zkllvm-metacraft-circuits/scripts/compile_and_run_tests.sh b/vendor/zkllvm-metacraft-circuits/scripts/compile_and_run_tests.sh index d79639460..0b3670ef3 100755 --- a/vendor/zkllvm-metacraft-circuits/scripts/compile_and_run_tests.sh +++ b/vendor/zkllvm-metacraft-circuits/scripts/compile_and_run_tests.sh @@ -14,6 +14,11 @@ then git clone git@github.com:metacraft-labs/finalizer-data.git $SCRIPT_DIR/../src/tests/verify_attestation_data_test/finalizer-data fi +if [ ! -d $SCRIPT_DIR/../../consensus-spec-tests ] +then + git clone git@github.com:ethereum/consensus-spec-tests.git $SCRIPT_DIR/../../consensus-spec-tests +fi + cd $CURRENT_DIR COMMAND='cmake -G "Unix Makefiles" -B ${ZKLLVM_BUILD:-build} -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=g++ . && make -C ${ZKLLVM_BUILD:-build} template'