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

Binary solver for array equality constraints #520

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1424f86
add a binary solver for array equality constraints
guipublic Nov 24, 2022
cd78f4c
Merge branch 'master' into gd/auto_return_array
guipublic Nov 24, 2022
2320abd
Merge branch 'master' into gd/auto_return_array
guipublic Nov 24, 2022
b515216
Merge branch 'master' into gd/auto_return_array
guipublic Nov 29, 2022
94ae8ee
Merge branch 'master' into gd/auto_return_array
guipublic Nov 30, 2022
673d03f
Code review
guipublic Dec 1, 2022
719d8d2
Code review
guipublic Dec 2, 2022
146d1e9
Merge branch 'master' into gd/auto_return_array
guipublic Dec 2, 2022
e4166c0
Code review
guipublic Dec 2, 2022
32b7c21
Merge branch 'master' into gd/auto_return_array
guipublic Dec 2, 2022
d84d0f8
Merge branch 'master' into gd/auto_return_array
guipublic Dec 6, 2022
ff19a06
Merge branch 'master' into gd/auto_return_array
guipublic Dec 7, 2022
eb2555e
code review: remove the closure
guipublic Dec 7, 2022
3d430db
Code review
guipublic Dec 9, 2022
ffe2674
Merge branch 'master' into gd/auto_return_array
guipublic Dec 9, 2022
52b90c9
Merge branch 'master' into gd/auto_return_array
guipublic Dec 12, 2022
aa7093d
Code review: remove pass number
guipublic Dec 12, 2022
e0e03ab
fix the build
guipublic Dec 12, 2022
0574d0f
Merge branch 'master' into gd/auto_return_array
guipublic Dec 12, 2022
4d2e097
Merge branch 'master' into gd/auto_return_array
guipublic Dec 12, 2022
da10422
Code review
guipublic Dec 13, 2022
33b922d
Merge branch 'master' into gd/auto_return_array
guipublic Dec 13, 2022
395d1b0
Merge branch 'master' into gd/auto_return_array
guipublic Dec 13, 2022
75dee9d
Merge branch 'master' into gd/auto_return_array
guipublic Jan 12, 2023
3038995
Merge branch 'master' into gd/auto_return_array
guipublic Jan 13, 2023
26507f9
Merge branch 'master' into gd/auto_return_array
guipublic Jan 16, 2023
5062107
Merge branch 'master' into gd/auto_return_array
guipublic Jan 17, 2023
7114370
Merge branch 'master' into gd/auto_return_array
guipublic Jan 17, 2023
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
6 changes: 2 additions & 4 deletions crates/acvm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub enum GateResolution {
UnknownError(String), //Generic error
UnsupportedOpcode(OPCODE), //Unsupported Opcode
UnsatisfiedConstrain, //Gate is not satisfied
Solved(usize), //Circuit is solved, after a number of passes
Solved, //Circuit is solved, after a number of passes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove the variant entirely? It is only returned by solve, but there is no reason solve could not return Resolved instead.

}

pub trait Backend: SmartContract + ProofSystemCompiler + PartialWitnessGenerator {}
Expand Down Expand Up @@ -190,7 +190,6 @@ pub trait PartialWitnessGenerator {
mut gates_to_resolve: Vec<Gate>,
) -> GateResolution {
let mut unresolved_gates: Vec<Gate> = Vec::new();
let mut pass_number = 0;
let mut ctx = BinarySolver::new();
//binary_solve is used to manage the binary solving mode:
//binary_solve.is_none() => binary solve is not activated
Expand Down Expand Up @@ -227,9 +226,8 @@ pub trait PartialWitnessGenerator {
binary_solve = Some(2);
}
std::mem::swap(&mut gates_to_resolve, &mut unresolved_gates);
pass_number += 1;
}
GateResolution::Solved(pass_number)
GateResolution::Solved
}

fn solve_gadget_call(
Expand Down
2 changes: 1 addition & 1 deletion crates/acvm/src/pwg/binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl BinarySolver {
| GateResolution::UnsatisfiedConstrain
| GateResolution::UnknownError(_) => return result,
GateResolution::Skip => (),
GateResolution::UnsupportedOpcode(_) | GateResolution::Solved(_) => unreachable!(),
GateResolution::UnsupportedOpcode(_) | GateResolution::Solved => unreachable!(),
jfecher marked this conversation as resolved.
Show resolved Hide resolved
}

if let Some(max) = self.is_binary(gate) {
Expand Down
2 changes: 1 addition & 1 deletion crates/nargo/src/cli/prove_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ fn solve_witness(
GateResolution::UnsatisfiedConstrain => return Err(CliError::Generic(
"could not satisfy all constraints".to_string()
)),
GateResolution::Resolved | GateResolution::Solved(_)=> (),
GateResolution::Resolved | GateResolution::Solved => (),
_ => unreachable!(),
}

Expand Down