Skip to content

Commit

Permalink
removes must_pass from is_satisfied #116
Browse files Browse the repository at this point in the history
  • Loading branch information
tshchelovek committed Mar 27, 2023
1 parent a3354b5 commit 0ae4057
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
19 changes: 3 additions & 16 deletions include/nil/blueprint/utils/satisfiability_check.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ namespace nil {
bool is_satisfied(circuit<crypto3::zk::snark::plonk_constraint_system<BlueprintFieldType,
ArithmetizationParams>> bp,
crypto3::zk::snark::plonk_assignment_table<BlueprintFieldType,
ArithmetizationParams> assignments,
bool must_pass = true) {
ArithmetizationParams> assignments) {

const std::vector<crypto3::zk::snark::plonk_gate<BlueprintFieldType, crypto3::zk::snark::plonk_constraint<BlueprintFieldType>>> gates =
bp.gates();
Expand All @@ -69,11 +68,7 @@ namespace nil {

if (!constraint_result.is_zero()) {
std::cout << "Constraint " << j << " from gate " << i << "on row " << selector_row << " is not satisfied." << std::endl;
if (must_pass) {
return false;
} else {
return true;
}
return false;
}
}
}
Expand All @@ -84,18 +79,10 @@ namespace nil {
if (var_value(assignments, copy_constraints[i].first) !=
var_value(assignments, copy_constraints[i].second)){
std::cout << "Copy constraint number " << i << " is not satisfied." << std::endl;
if (must_pass) {
return false;
} else {
return true;
}
return false;
}
}

if (!must_pass) {
std::cout << "All constraints are satisfied." << std::endl;
return false;
}
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion test/test_plonk_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ namespace nil {
profiling(assignment);
#endif

assert(blueprint::is_satisfied(bp, assignment, must_pass));
assert(blueprint::is_satisfied(bp, assignment) == must_pass);

return std::make_tuple(desc, bp, assignment);
}
Expand Down

0 comments on commit 0ae4057

Please sign in to comment.