Skip to content

Commit

Permalink
Added check for islands to connectedness check.
Browse files Browse the repository at this point in the history
  • Loading branch information
Iluvmagick committed Dec 8, 2023
1 parent 9da6da0 commit c590ced
Show file tree
Hide file tree
Showing 21 changed files with 350 additions and 132 deletions.
216 changes: 190 additions & 26 deletions include/nil/blueprint/utils/connectedness_check.hpp

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions test/algebra/fields/plonk/non_native/bit_composition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ void test_bit_composition(const std::vector<typename BlueprintFieldType::value_t
if (expected_to_pass) {
crypto3::test_component<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>(
component_instance, bits, result_check, instance_input,
crypto3::detail::connectedness_check_type::STRONG, BitsAmount, CheckInput);
crypto3::connectedness_check_type::type::STRONG, BitsAmount, CheckInput);
} else {
crypto3::test_component_to_fail<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>(
component_instance, bits, result_check, instance_input,
crypto3::detail::connectedness_check_type::STRONG, BitsAmount, CheckInput);
crypto3::connectedness_check_type::type::STRONG, BitsAmount, CheckInput);
}
} else {
auto custom_assignments = crypto3::generate_patched_assignments<BlueprintFieldType,
Expand All @@ -120,7 +120,7 @@ void test_bit_composition(const std::vector<typename BlueprintFieldType::value_t
component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>
(component_instance, bits, result_check,
custom_assignments, instance_input,
crypto3::detail::connectedness_check_type::STRONG, BitsAmount, CheckInput);
crypto3::connectedness_check_type::type::STRONG, BitsAmount, CheckInput);
}
}

Expand Down
6 changes: 3 additions & 3 deletions test/algebra/fields/plonk/non_native/bit_decomposition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,19 @@ void test_bit_decomposition(typename BlueprintFieldType::value_type input,
if (expected_to_pass) {
crypto3::test_component<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>(
component_instance, public_input, result_check, instance_input,
crypto3::detail::connectedness_check_type::STRONG, BitsAmount);
crypto3::connectedness_check_type::type::STRONG, BitsAmount);
} else {
crypto3::test_component_to_fail<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>(
component_instance, public_input, result_check, instance_input,
crypto3::detail::connectedness_check_type::STRONG, BitsAmount);
crypto3::connectedness_check_type::type::STRONG, BitsAmount);
}
} else {
auto custom_assignments = crypto3::generate_patched_assignments<BlueprintFieldType,
ArithmetizationParams, component_type>(patches);
crypto3::test_component_to_fail_custom_assignments<
component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>
(component_instance, public_input, result_check, custom_assignments, instance_input,
crypto3::detail::connectedness_check_type::STRONG, BitsAmount);
crypto3::connectedness_check_type::type::STRONG, BitsAmount);
}
}

Expand Down
4 changes: 2 additions & 2 deletions test/algebra/fields/plonk/non_native/bit_shift_constant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ void test_bit_shift(typename BlueprintFieldType::value_type input,
if (expected_to_pass) {
crypto3::test_component<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>(
component_instance, public_input, result_check, instance_input,
nil::crypto3::detail::connectedness_check_type::STRONG, BitsAmount, Shift, Mode);
nil::blueprint::connectedness_check_type::type::STRONG, BitsAmount, Shift, Mode);
} else {
crypto3::test_component_to_fail<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>(
component_instance, public_input, result_check, instance_input,
nil::crypto3::detail::connectedness_check_type::STRONG, BitsAmount, Shift, Mode);
nil::blueprint::connectedness_check_type::type::STRONG, BitsAmount, Shift, Mode);
}
}

Expand Down
8 changes: 4 additions & 4 deletions test/algebra/fields/plonk/non_native/comparison_checked.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ auto test_comparison_checked(typename BlueprintFieldType::value_type x,
if (expected_to_pass) {
nil::crypto3::test_component<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>(
component_instance, public_input, result_check, instance_input,
nil::crypto3::detail::connectedness_check_type::STRONG, R, Mode);
nil::blueprint::connectedness_check_type::type::STRONG, R, Mode);
} else {
nil::crypto3::test_component_to_fail<component_type, BlueprintFieldType, ArithmetizationParams,
hash_type, Lambda>(
component_instance, public_input, result_check, instance_input,
nil::crypto3::detail::connectedness_check_type::STRONG, R, Mode);
nil::blueprint::connectedness_check_type::type::STRONG, R, Mode);
}
} else {
auto custom_assignment = nil::crypto3::generate_patched_assignments<
Expand All @@ -123,13 +123,13 @@ auto test_comparison_checked(typename BlueprintFieldType::value_type x,
hash_type, Lambda>(
component_instance, public_input,
result_check, custom_assignment, instance_input,
nil::crypto3::detail::connectedness_check_type::STRONG, R, Mode);
nil::blueprint::connectedness_check_type::type::STRONG, R, Mode);
} else {
nil::crypto3::test_component_to_fail_custom_assignments<component_type, BlueprintFieldType,
ArithmetizationParams, hash_type, Lambda>(
component_instance, public_input, result_check,
custom_assignment, instance_input,
nil::crypto3::detail::connectedness_check_type::STRONG, R, Mode);
nil::blueprint::connectedness_check_type::type::STRONG, R, Mode);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions test/algebra/fields/plonk/non_native/comparison_flag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ auto test_comparison_flag(typename BlueprintFieldType::value_type x, typename Bl
if (expected_to_pass) {
nil::crypto3::test_component<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>(
component_instance, public_input, result_check, instance_input,
nil::crypto3::detail::connectedness_check_type::STRONG, R, Mode);
nil::blueprint::connectedness_check_type::type::STRONG, R, Mode);
} else {
nil::crypto3::test_component_to_fail<component_type, BlueprintFieldType, ArithmetizationParams,
hash_type, Lambda>(
component_instance, public_input, result_check, instance_input,
nil::crypto3::detail::connectedness_check_type::STRONG, R, Mode);
nil::blueprint::connectedness_check_type::type::STRONG, R, Mode);
}
} else {
// Currently, the only custom assignment test here is for failure
Expand All @@ -131,7 +131,7 @@ auto test_comparison_flag(typename BlueprintFieldType::value_type x, typename Bl
ArithmetizationParams, hash_type, Lambda>(
component_instance, public_input, result_check,
custom_assignment, instance_input,
nil::crypto3::detail::connectedness_check_type::STRONG, R, Mode);
nil::blueprint::connectedness_check_type::type::STRONG, R, Mode);
}
}

Expand Down
8 changes: 4 additions & 4 deletions test/algebra/fields/plonk/non_native/comparison_unchecked.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ auto test_comparison_unchecked(typename BlueprintFieldType::value_type x,
if (expected_to_pass) {
nil::crypto3::test_component<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>(
component_instance, public_input, result_check, instance_input,
nil::crypto3::detail::connectedness_check_type::STRONG, R, Mode);
nil::blueprint::connectedness_check_type::type::STRONG, R, Mode);
} else {
nil::crypto3::test_component_to_fail<component_type, BlueprintFieldType, ArithmetizationParams,
hash_type, Lambda>(
component_instance, public_input, result_check, instance_input,
nil::crypto3::detail::connectedness_check_type::STRONG, R, Mode);
nil::blueprint::connectedness_check_type::type::STRONG, R, Mode);
}
} else {
auto custom_assignment = nil::crypto3::generate_patched_assignments<
Expand All @@ -125,13 +125,13 @@ auto test_comparison_unchecked(typename BlueprintFieldType::value_type x,
hash_type, Lambda>(
component_instance, public_input,
result_check, custom_assignment, instance_input,
nil::crypto3::detail::connectedness_check_type::STRONG, R, Mode);
nil::blueprint::connectedness_check_type::type::STRONG, R, Mode);
} else {
nil::crypto3::test_component_to_fail_custom_assignments<component_type, BlueprintFieldType,
ArithmetizationParams, hash_type, Lambda>(
component_instance, public_input, result_check,
custom_assignment, instance_input,
nil::crypto3::detail::connectedness_check_type::STRONG, R, Mode);
nil::blueprint::connectedness_check_type::type::STRONG, R, Mode);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions test/algebra/fields/plonk/non_native/division_remainder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ auto test_division_remainder(typename BlueprintFieldType::value_type x,
if (expected_to_pass) {
nil::crypto3::test_component<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>(
component_instance, public_input, result_check, instance_input,
nil::crypto3::detail::connectedness_check_type::STRONG, R, CheckInputs);
nil::blueprint::connectedness_check_type::type::STRONG, R, CheckInputs);
} else {
nil::crypto3::test_component_to_fail<component_type, BlueprintFieldType, ArithmetizationParams,
hash_type, Lambda>(
component_instance, public_input, result_check, instance_input,
nil::crypto3::detail::connectedness_check_type::STRONG,
nil::blueprint::connectedness_check_type::type::STRONG,
R, CheckInputs);
}
} else {
Expand All @@ -117,7 +117,7 @@ auto test_division_remainder(typename BlueprintFieldType::value_type x,
ArithmetizationParams, hash_type, Lambda>(
component_instance, public_input, result_check,
custom_assignment, instance_input,
nil::crypto3::detail::connectedness_check_type::STRONG, R, CheckInputs);
nil::blueprint::connectedness_check_type::type::STRONG, R, CheckInputs);
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/algebra/fields/plonk/non_native/equality_flag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void test_equality_flag(const std::vector<typename BlueprintFieldType::value_typ

nil::crypto3::test_component<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>
(component_instance, public_input, result_check, instance_input,
nil::crypto3::detail::connectedness_check_type::STRONG, inequality);
nil::blueprint::connectedness_check_type::type::STRONG, inequality);
}

template <typename BlueprintFieldType, std::size_t RandomTestsAmount>
Expand Down
8 changes: 4 additions & 4 deletions test/algebra/fields/plonk/range_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ auto test_range_check(typename BlueprintFieldType::value_type input,
if (expected_to_pass) {
nil::crypto3::test_component<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>(
component_instance, public_input, result_check, instance_input,
nil::crypto3::detail::connectedness_check_type::STRONG, R);
nil::blueprint::connectedness_check_type::type::STRONG, R);
} else {
nil::crypto3::test_component_to_fail<component_type, BlueprintFieldType, ArithmetizationParams,
hash_type, Lambda>(
component_instance, public_input, result_check, instance_input,
nil::crypto3::detail::connectedness_check_type::STRONG, R);
nil::blueprint::connectedness_check_type::type::STRONG, R);
}
} else {
auto custom_assignment = nil::crypto3::generate_patched_assignments<
Expand All @@ -121,13 +121,13 @@ auto test_range_check(typename BlueprintFieldType::value_type input,
hash_type, Lambda>(
component_instance, public_input,
result_check, custom_assignment, instance_input,
nil::crypto3::detail::connectedness_check_type::STRONG, R);
nil::blueprint::connectedness_check_type::type::STRONG, R);
} else {
nil::crypto3::test_component_to_fail_custom_assignments<component_type, BlueprintFieldType,
ArithmetizationParams, hash_type, Lambda>(
component_instance, public_input, result_check,
custom_assignment, instance_input,
nil::crypto3::detail::connectedness_check_type::STRONG, R);
nil::blueprint::connectedness_check_type::type::STRONG, R);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/non_native/plonk/add_mul_zkllvm_compatible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ void test_mul(typename CurveType::base_field_type::value_type b_val,
crypto3::test_component<stretched_component_type, BlueprintFieldType,
ArithmetizationParams, hash_type, Lambda>(
stretched_instance, public_input, result_check, instance_input,
nil::crypto3::detail::connectedness_check_type::STRONG, 253);
nil::blueprint::connectedness_check_type::type::STRONG, 253);
} else {
crypto3::test_component<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>(
component_instance, public_input, result_check, instance_input,
nil::crypto3::detail::connectedness_check_type::STRONG, 253);
nil::blueprint::connectedness_check_type::type::STRONG, 253);
}
}

Expand Down
Loading

0 comments on commit c590ced

Please sign in to comment.