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

Fix miss connectness of components #579

Closed
wants to merge 9 commits into from
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
26 changes: 18 additions & 8 deletions .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,26 @@ jobs:

- name: Build assignment tables(.tbl) of the C++ examples
run: |
cmake --build build -t cpp_examples_generate_tbl
cmake --build build -t cpp_examples_generate_tbl_no_check
ls -al ./build/examples/cpp

- name: Copy assigner output from separate generation mode
CblPOK-git marked this conversation as resolved.
Show resolved Hide resolved
run: |
bash ./tests/copy_assigner_outputs.sh build/separate_generatuon

- name: Run simultaneous .tbl and .crct generation of the C++ examples
run: |
cmake --build build -t cpp_examples_generate_both_no_check
ls -al ./build/examples/cpp

- name: Copy assigner output from simultaneous generation mode
run: |
bash ./tests/copy_assigner_outputs.sh build/simultaneous_generation

- name: Compare different assigner modes output
run: |
bash ./tests/compare_folders_content.sh build/separate_generatuon build/simultaneous_generation

- name: Run size estimation for C++ examples
run: |
cmake --build build -t cpp_examples_estimate_size
Expand Down Expand Up @@ -230,13 +247,6 @@ jobs:
run: |
cmake --build build -t check-crypto3-assigner

- name: Run assigner tests
run: |
cd libs/assigner/test
chmod +x run_tests.py
python3 run_tests.py ../../../build/bin/assigner/assigner
cd ../../../

- name: Build proof for the circuit of the C++ examples
run: |
cmake --build build -t prove_cpp_examples
Expand Down
9 changes: 1 addition & 8 deletions .github/workflows/build_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ jobs:

- name: Build assignment tables(.tbl) of the C++ examples
run: |
cmake --build build -t cpp_examples_generate_tbl
cmake --build build -t cpp_examples_generate_tbl_no_check
ls -al ./build/examples/cpp

- name: Run size estimation for C++ examples
Expand Down Expand Up @@ -157,13 +157,6 @@ jobs:
run: |
cmake --build build -t check-crypto3-assigner

- name: Run assigner tests
run: |
cd libs/assigner/test
chmod +x run_tests.py
python3 run_tests.py ../../../build/bin/assigner/assigner
cd ../../../

- name: Build proof for the circuit of the C++ examples
run: |
cmake --build build -t prove_cpp_examples
Expand Down
2 changes: 1 addition & 1 deletion bin/assigner/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ int curve_dependent_main(std::string bytecode_file_name,
BOOST_LOG_TRIVIAL(debug) << "overall_table_printing_duration: " << overall_table_printing_duration.count() << "ms";

auto check_validity_start = std::chrono::high_resolution_clock::now();
if (check_validity && gen_mode.has_assignments() && gen_mode.has_circuit()) {
if (check_validity && gen_mode.has_assignments()) {
if (assigner_instance.assignments.size() == 1 && (target_prover == 0 || target_prover == invalid_target_prover)) {
ASSERT_MSG(nil::blueprint::is_satisfied(assigner_instance.circuits[0].get(), assigner_instance.assignments[0].get()),
"The circuit is not satisfied");
Expand Down
27 changes: 27 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@ function(assign_ir)
COMMAND_EXPAND_LISTS
VERBATIM)

add_custom_target(${target}_generate_both_no_check
COMMAND $<TARGET_FILE:assigner>
-b ${binary_name}
-i ${INPUTS_DIR}/${input}
${minus_p} ${private_input_string}
-c circuit_${target}.crct
-t assignment_${target}.tbl -e ${curve_type}
--generate-type circuit-assignment
${max_num_provers_flag} ${max_num_provers_amount}
${arithmetization_flag} ${arithmetization_amount}
DEPENDS ${target} ${INPUTS_DIR}/${input} $<TARGET_FILE:assigner>
COMMAND_EXPAND_LISTS
VERBATIM)

add_custom_target(${target}_generate_tbl
COMMAND $<TARGET_FILE:assigner>
-b ${binary_name}
Expand All @@ -69,6 +83,19 @@ function(assign_ir)
COMMAND_EXPAND_LISTS
VERBATIM)

add_custom_target(${target}_generate_tbl_no_check
COMMAND $<TARGET_FILE:assigner>
-b ${binary_name}
-i ${INPUTS_DIR}/${input}
${minus_p} ${private_input_string}
-t assignment_${target}.tbl -e ${curve_type}
--generate-type assignment
${max_num_provers_flag} ${max_num_provers_amount}
${arithmetization_flag} ${arithmetization_amount}
DEPENDS ${target} ${INPUTS_DIR}/${input} $<TARGET_FILE:assigner>
COMMAND_EXPAND_LISTS
VERBATIM)

add_custom_target(${target}_estimate_size
COMMAND $<TARGET_FILE:assigner>
-b ${binary_name}
Expand Down
5 changes: 4 additions & 1 deletion examples/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
add_custom_target(compile_cpp_examples)
add_custom_target(cpp_examples_generate_tbl)
add_custom_target(cpp_examples_generate_tbl_no_check)
add_custom_target(cpp_examples_generate_crct)
add_custom_target(cpp_examples_generate_both)
add_custom_target(cpp_examples_generate_both_no_check)
add_custom_target(prove_cpp_examples)
add_custom_target(cpp_examples_estimate_size)

Expand Down Expand Up @@ -68,8 +70,10 @@ function(add_example_without_proving example_target)
assign_ir(${example_target} ${binary_name} ${ARG_INPUT} ${ARG_PRIVATE_INPUT} ${ARG_CURVE_TYPE} ${ARG_ARITHMETIZARION} ${ARG_MAX_NUM_PROVERS})

add_dependencies(cpp_examples_generate_tbl ${example_target}_generate_tbl)
add_dependencies(cpp_examples_generate_tbl_no_check ${example_target}_generate_tbl_no_check)
add_dependencies(cpp_examples_generate_crct ${example_target}_generate_crct)
add_dependencies(cpp_examples_generate_both ${example_target}_generate_both)
add_dependencies(cpp_examples_generate_both_no_check ${example_target}_generate_both_no_check)
add_dependencies(cpp_examples_estimate_size ${example_target}_estimate_size)
endfunction()

Expand Down Expand Up @@ -138,7 +142,6 @@ add_example_with_proving(merkle_poseidon_21prover_3layers_cpp_example SOURCES me
add_example_without_proving(merkle_tree_sha2_256_cpp_example SOURCES merkle_tree_sha2_256.cpp INPUT merkle_tree_sha2_256.inp CURVE_TYPE pallas)
add_example_without_proving(validate_merkle_path_sha2_256_cpp_example SOURCES validate_merkle_path_sha2_256.cpp INPUT validate_merkle_path_sha2_256.inp CURVE_TYPE pallas)
add_example_without_proving(sha256_cpp_example SOURCES sha2_256.cpp INPUT sha2_256.inp CURVE_TYPE pallas)
add_example_with_proving(balance_cpp_example SOURCES balance.cpp INPUT balance.inp CURVE_TYPE pallas)
add_example_with_proving(memory_cpp_example SOURCES memory.cpp INPUT memory.inp CURVE_TYPE pallas)
add_example_with_proving(polynomial_cpp_example SOURCES polynomial.cpp INPUT polynomial.inp COMPILER_OPTIONS -std=c++20 CURVE_TYPE pallas)
add_example_with_proving(pallas_curve_addition_cpp_example
Expand Down
24 changes: 0 additions & 24 deletions examples/cpp/balance.cpp

This file was deleted.

3 changes: 0 additions & 3 deletions examples/inputs/balance.inp

This file was deleted.

2 changes: 1 addition & 1 deletion libs/assigner
Submodule assigner updated 112 files
20 changes: 20 additions & 0 deletions tests/compare_folders_content.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# check that the number of files in both directories is equal
count1=$(find "$1" -type f | wc -l)
count2=$(find "$2" -type f | wc -l)

if [ "$count1" -eq "$count2" ]; then
echo "The number of files in both directories is equal."
else
echo "The number of files differs: $1 has $count1 files, $2 has $count2 files."
exit 1
fi

# Check that both directories contain identical list of files
diff -qr "$1" "$2" | grep 'Only in' && exit 1
echo "Both directories contain files with the same names."

diff -r "$1" "$2"
if [ $? -ne 0 ]; then
exit 1
fi
echo "Comparison completed."
11 changes: 11 additions & 0 deletions tests/copy_assigner_outputs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
SRC_DIR="build/examples/cpp"
DEST_DIR="$1"

if [ ! -d "$DEST_DIR" ]; then
mkdir -p "$DEST_DIR"
fi

find "$SRC_DIR" -type f -name "*.crct*" -exec cp {} "$DEST_DIR" \;
find "$SRC_DIR" -type f -name "*.tbl*" -exec cp {} "$DEST_DIR" \;

echo "All .crct and .tbl files have been copied from $SRC_DIR to $DEST_DIR."
10 changes: 10 additions & 0 deletions tests/run_different_generation_modes_comparison.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
rm -r build/examples/cpp
rm -r build/1
rm -r build/2
/usr/bin/cmake --build "$(pwd)/build" --config Debug --target cpp_examples_generate_tbl_no_check --
/usr/bin/cmake --build "$(pwd)/build" --config Debug --target cpp_examples_generate_crct --
bash tests/copy_assigner_outputs.sh build/1
/usr/bin/cmake --build "$(pwd)/build" --config Debug --target cpp_examples_generate_both_no_check --
bash tests/copy_assigner_outputs.sh build/2

bash tests/compare_folders_content.sh build/1 build/2
Loading