Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added documentation for compute_shuffled_index. #279

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions vendor/zkllvm-metacraft-circuits/docs/compute_shuffled_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Compute shuffled index documentation.

### *Implementation*
The implementation code of the circuit is under "DendrETH/vendor/zkllvm-metacraft-circuits/src/circuits_impl/compute_shuffled_index_impl.h".
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/compute_shuffled_index.cpp". 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", which by default runs all tests. We can pass as argument to this script "compute_shuffled_index_test" which will only run the relevant tests. For example, run the script from the main project directory "DendrETH/vendor/zkllvm-metacraft-circuits" as follows:
`./scripts/compile_and_run_tests.sh compute_shuffled_index_test`
It is required that docker is installed on the machine that will run the tests.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Verify attestation data and proof finality documentation.

### *Implementation*
The implementation code of the circuit is under "DendrETH/vendor/zkllvm-metacraft-circuits/src/circuits_impl/verify_attestation_data_impl.h".
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/verify_attestation_data.cpp". This file also contains the proof_finality logic.

### *Executable build + tests*
The implementation code of the circuit is compiled as executable and tested against input data extracted from
an Ethereum node. The tests reside in "DendrETH/vendor/zkllvm-metacraft-circuits/src/tests/verify_attestation_data_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", which by default runs all tests. We can pass as argument to this script "verify_attestation_data_test" which will only run the relevant tests. For example, run the script from the main project directory "DendrETH/vendor/zkllvm-metacraft-circuits" as follows:
`./scripts/compile_and_run_tests.sh verify_attestation_data_test`
It is required that docker is installed on the machine that will run the tests.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Weigh justification and finalization documentation.

### *Implementation*
The implementation code of the circuit is under "DendrETH/vendor/zkllvm-metacraft-circuits/src/circuits_impl/weigh_justification_and_finalization_impl.h".
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/weigh_justification_and_finalization.cpp".

### *Executable build + tests*
The implementation code of the circuit is compiled as executable and tested against input data extracted from an Ethereum node. The tests reside in "DendrETH/vendor/zkllvm-metacraft-circuits/src/tests/weigh_justification_and_finalization_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", which by default runs all tests. We can pass as argument to this script "weigh_justification_and_finalization_test" which will only run the relevant tests. For example, run the script from the main project directory "DendrETH/vendor/zkllvm-metacraft-circuits" as follows:
`./scripts/compile_and_run_tests.sh weigh_justification_and_finalization_test`
It is required that docker is installed on the machine that will run the tests.
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Loading