Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Commit c6dc9fc

Browse files
authored
Added check for islands to connectedness check. (#293)
1 parent f49b3f6 commit c6dc9fc

21 files changed

+360
-140
lines changed

include/nil/blueprint/utils/connectedness_check.hpp

Lines changed: 193 additions & 27 deletions
Large diffs are not rendered by default.

test/algebra/fields/plonk/non_native/bit_composition.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,14 @@ void test_bit_composition(const std::vector<typename BlueprintFieldType::value_t
107107
if (expected_to_pass) {
108108
crypto3::test_component<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>(
109109
component_instance, bits, result_check, instance_input,
110-
crypto3::detail::connectedness_check_type::STRONG, BitsAmount, CheckInput);
110+
nil::blueprint::connectedness_check_type::type::STRONG, BitsAmount, CheckInput);
111111
crypto3::test_empty_component<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>(
112112
component_instance, bits, result_check, instance_input,
113-
crypto3::detail::connectedness_check_type::STRONG, BitsAmount, CheckInput);
113+
nil::blueprint::connectedness_check_type::type::STRONG, BitsAmount, CheckInput);
114114
} else {
115115
crypto3::test_component_to_fail<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>(
116116
component_instance, bits, result_check, instance_input,
117-
crypto3::detail::connectedness_check_type::STRONG, BitsAmount, CheckInput);
117+
nil::blueprint::connectedness_check_type::type::STRONG, BitsAmount, CheckInput);
118118
}
119119
} else {
120120
auto custom_assignments = crypto3::generate_patched_assignments<BlueprintFieldType,
@@ -123,7 +123,7 @@ void test_bit_composition(const std::vector<typename BlueprintFieldType::value_t
123123
component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>
124124
(component_instance, bits, result_check,
125125
custom_assignments, instance_input,
126-
crypto3::detail::connectedness_check_type::STRONG, BitsAmount, CheckInput);
126+
nil::blueprint::connectedness_check_type::type::STRONG, BitsAmount, CheckInput);
127127
}
128128
}
129129

test/algebra/fields/plonk/non_native/bit_decomposition.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,22 +111,22 @@ void test_bit_decomposition(typename BlueprintFieldType::value_type input,
111111
if (expected_to_pass) {
112112
crypto3::test_component<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>(
113113
component_instance, public_input, result_check, instance_input,
114-
crypto3::detail::connectedness_check_type::STRONG, BitsAmount);
114+
nil::blueprint::connectedness_check_type::type::STRONG, BitsAmount);
115115
crypto3::test_empty_component<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>(
116116
component_instance, public_input, result_check, instance_input,
117-
crypto3::detail::connectedness_check_type::STRONG, BitsAmount);
117+
nil::blueprint::connectedness_check_type::type::STRONG, BitsAmount);
118118
} else {
119119
crypto3::test_component_to_fail<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>(
120120
component_instance, public_input, result_check, instance_input,
121-
crypto3::detail::connectedness_check_type::STRONG, BitsAmount);
121+
nil::blueprint::connectedness_check_type::type::STRONG, BitsAmount);
122122
}
123123
} else {
124124
auto custom_assignments = crypto3::generate_patched_assignments<BlueprintFieldType,
125125
ArithmetizationParams, component_type>(patches);
126126
crypto3::test_component_to_fail_custom_assignments<
127127
component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>
128128
(component_instance, public_input, result_check, custom_assignments, instance_input,
129-
crypto3::detail::connectedness_check_type::STRONG, BitsAmount);
129+
nil::blueprint::connectedness_check_type::type::STRONG, BitsAmount);
130130
}
131131
}
132132

test/algebra/fields/plonk/non_native/bit_shift_constant.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ void test_bit_shift(typename BlueprintFieldType::value_type input,
9191
if (expected_to_pass) {
9292
crypto3::test_component<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>(
9393
component_instance, public_input, result_check, instance_input,
94-
nil::crypto3::detail::connectedness_check_type::STRONG, BitsAmount, Shift, Mode);
94+
nil::blueprint::connectedness_check_type::type::STRONG, BitsAmount, Shift, Mode);
9595
} else {
9696
crypto3::test_component_to_fail<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>(
9797
component_instance, public_input, result_check, instance_input,
98-
nil::crypto3::detail::connectedness_check_type::STRONG, BitsAmount, Shift, Mode);
98+
nil::blueprint::connectedness_check_type::type::STRONG, BitsAmount, Shift, Mode);
9999
}
100100
}
101101

test/algebra/fields/plonk/non_native/comparison_checked.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ auto test_comparison_checked(typename BlueprintFieldType::value_type x,
107107
if (expected_to_pass) {
108108
nil::crypto3::test_component<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>(
109109
component_instance, public_input, result_check, instance_input,
110-
nil::crypto3::detail::connectedness_check_type::STRONG, R, Mode);
110+
nil::blueprint::connectedness_check_type::type::STRONG, R, Mode);
111111
} else {
112112
nil::crypto3::test_component_to_fail<component_type, BlueprintFieldType, ArithmetizationParams,
113113
hash_type, Lambda>(
114114
component_instance, public_input, result_check, instance_input,
115-
nil::crypto3::detail::connectedness_check_type::STRONG, R, Mode);
115+
nil::blueprint::connectedness_check_type::type::STRONG, R, Mode);
116116
}
117117
} else {
118118
auto custom_assignment = nil::crypto3::generate_patched_assignments<
@@ -123,13 +123,13 @@ auto test_comparison_checked(typename BlueprintFieldType::value_type x,
123123
hash_type, Lambda>(
124124
component_instance, public_input,
125125
result_check, custom_assignment, instance_input,
126-
nil::crypto3::detail::connectedness_check_type::STRONG, R, Mode);
126+
nil::blueprint::connectedness_check_type::type::STRONG, R, Mode);
127127
} else {
128128
nil::crypto3::test_component_to_fail_custom_assignments<component_type, BlueprintFieldType,
129129
ArithmetizationParams, hash_type, Lambda>(
130130
component_instance, public_input, result_check,
131131
custom_assignment, instance_input,
132-
nil::crypto3::detail::connectedness_check_type::STRONG, R, Mode);
132+
nil::blueprint::connectedness_check_type::type::STRONG, R, Mode);
133133
}
134134
}
135135
}

test/algebra/fields/plonk/non_native/comparison_flag.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,15 @@ auto test_comparison_flag(typename BlueprintFieldType::value_type x, typename Bl
115115
if (expected_to_pass) {
116116
nil::crypto3::test_component<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>(
117117
component_instance, public_input, result_check, instance_input,
118-
nil::crypto3::detail::connectedness_check_type::STRONG, R, Mode);
118+
nil::blueprint::connectedness_check_type::type::STRONG, R, Mode);
119119
nil::crypto3::test_empty_component<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>(
120120
component_instance, public_input, result_check, instance_input,
121-
nil::crypto3::detail::connectedness_check_type::STRONG, R, Mode);
121+
nil::blueprint::connectedness_check_type::type::STRONG, R, Mode);
122122
} else {
123123
nil::crypto3::test_component_to_fail<component_type, BlueprintFieldType, ArithmetizationParams,
124124
hash_type, Lambda>(
125125
component_instance, public_input, result_check, instance_input,
126-
nil::crypto3::detail::connectedness_check_type::STRONG, R, Mode);
126+
nil::blueprint::connectedness_check_type::type::STRONG, R, Mode);
127127
}
128128
} else {
129129
// Currently, the only custom assignment test here is for failure
@@ -134,7 +134,7 @@ auto test_comparison_flag(typename BlueprintFieldType::value_type x, typename Bl
134134
ArithmetizationParams, hash_type, Lambda>(
135135
component_instance, public_input, result_check,
136136
custom_assignment, instance_input,
137-
nil::crypto3::detail::connectedness_check_type::STRONG, R, Mode);
137+
nil::blueprint::connectedness_check_type::type::STRONG, R, Mode);
138138
}
139139
}
140140

test/algebra/fields/plonk/non_native/comparison_unchecked.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ auto test_comparison_unchecked(typename BlueprintFieldType::value_type x,
109109
if (expected_to_pass) {
110110
nil::crypto3::test_component<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>(
111111
component_instance, public_input, result_check, instance_input,
112-
nil::crypto3::detail::connectedness_check_type::STRONG, R, Mode);
112+
nil::blueprint::connectedness_check_type::type::STRONG, R, Mode);
113113
} else {
114114
nil::crypto3::test_component_to_fail<component_type, BlueprintFieldType, ArithmetizationParams,
115115
hash_type, Lambda>(
116116
component_instance, public_input, result_check, instance_input,
117-
nil::crypto3::detail::connectedness_check_type::STRONG, R, Mode);
117+
nil::blueprint::connectedness_check_type::type::STRONG, R, Mode);
118118
}
119119
} else {
120120
auto custom_assignment = nil::crypto3::generate_patched_assignments<
@@ -125,13 +125,13 @@ auto test_comparison_unchecked(typename BlueprintFieldType::value_type x,
125125
hash_type, Lambda>(
126126
component_instance, public_input,
127127
result_check, custom_assignment, instance_input,
128-
nil::crypto3::detail::connectedness_check_type::STRONG, R, Mode);
128+
nil::blueprint::connectedness_check_type::type::STRONG, R, Mode);
129129
} else {
130130
nil::crypto3::test_component_to_fail_custom_assignments<component_type, BlueprintFieldType,
131131
ArithmetizationParams, hash_type, Lambda>(
132132
component_instance, public_input, result_check,
133133
custom_assignment, instance_input,
134-
nil::crypto3::detail::connectedness_check_type::STRONG, R, Mode);
134+
nil::blueprint::connectedness_check_type::type::STRONG, R, Mode);
135135
}
136136
}
137137
}

test/algebra/fields/plonk/non_native/division_remainder.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,15 @@ auto test_division_remainder(typename BlueprintFieldType::value_type x,
101101
if (expected_to_pass) {
102102
nil::crypto3::test_component<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>(
103103
component_instance, public_input, result_check, instance_input,
104-
nil::crypto3::detail::connectedness_check_type::STRONG, R, CheckInputs);
104+
nil::blueprint::connectedness_check_type::type::STRONG, R, CheckInputs);
105105
nil::crypto3::test_empty_component<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>(
106106
component_instance, public_input, result_check, instance_input,
107-
nil::crypto3::detail::connectedness_check_type::STRONG, R, CheckInputs);
107+
nil::blueprint::connectedness_check_type::type::STRONG, R, CheckInputs);
108108
} else {
109109
nil::crypto3::test_component_to_fail<component_type, BlueprintFieldType, ArithmetizationParams,
110110
hash_type, Lambda>(
111111
component_instance, public_input, result_check, instance_input,
112-
nil::crypto3::detail::connectedness_check_type::STRONG,
112+
nil::blueprint::connectedness_check_type::type::STRONG,
113113
R, CheckInputs);
114114
}
115115
} else {
@@ -120,7 +120,7 @@ auto test_division_remainder(typename BlueprintFieldType::value_type x,
120120
ArithmetizationParams, hash_type, Lambda>(
121121
component_instance, public_input, result_check,
122122
custom_assignment, instance_input,
123-
nil::crypto3::detail::connectedness_check_type::STRONG, R, CheckInputs);
123+
nil::blueprint::connectedness_check_type::type::STRONG, R, CheckInputs);
124124
}
125125
}
126126

test/algebra/fields/plonk/non_native/equality_flag.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void test_equality_flag(const std::vector<typename BlueprintFieldType::value_typ
8484

8585
nil::crypto3::test_component<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>
8686
(component_instance, public_input, result_check, instance_input,
87-
nil::crypto3::detail::connectedness_check_type::STRONG, inequality);
87+
nil::blueprint::connectedness_check_type::type::STRONG, inequality);
8888
}
8989

9090
template <typename BlueprintFieldType, std::size_t RandomTestsAmount>

test/algebra/fields/plonk/range_check.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,12 @@ auto test_range_check(typename BlueprintFieldType::value_type input,
105105
if (expected_to_pass) {
106106
nil::crypto3::test_component<component_type, BlueprintFieldType, ArithmetizationParams, hash_type, Lambda>(
107107
component_instance, public_input, result_check, instance_input,
108-
nil::crypto3::detail::connectedness_check_type::STRONG, R);
108+
nil::blueprint::connectedness_check_type::type::STRONG, R);
109109
} else {
110110
nil::crypto3::test_component_to_fail<component_type, BlueprintFieldType, ArithmetizationParams,
111111
hash_type, Lambda>(
112112
component_instance, public_input, result_check, instance_input,
113-
nil::crypto3::detail::connectedness_check_type::STRONG, R);
113+
nil::blueprint::connectedness_check_type::type::STRONG, R);
114114
}
115115
} else {
116116
auto custom_assignment = nil::crypto3::generate_patched_assignments<
@@ -121,13 +121,13 @@ auto test_range_check(typename BlueprintFieldType::value_type input,
121121
hash_type, Lambda>(
122122
component_instance, public_input,
123123
result_check, custom_assignment, instance_input,
124-
nil::crypto3::detail::connectedness_check_type::STRONG, R);
124+
nil::blueprint::connectedness_check_type::type::STRONG, R);
125125
} else {
126126
nil::crypto3::test_component_to_fail_custom_assignments<component_type, BlueprintFieldType,
127127
ArithmetizationParams, hash_type, Lambda>(
128128
component_instance, public_input, result_check,
129129
custom_assignment, instance_input,
130-
nil::crypto3::detail::connectedness_check_type::STRONG, R);
130+
nil::blueprint::connectedness_check_type::type::STRONG, R);
131131
}
132132
}
133133
}

0 commit comments

Comments
 (0)