-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
587 additions
and
347 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,48 @@ | ||
pub use crate::circuit::ir::hint_normalized::witness_solver::WitnessSolver; | ||
use crate::circuit::layered::witness::Witness; | ||
use crate::{circuit::layered::witness::Witness, hints::registry::HintRegistry}; | ||
|
||
use super::{internal, Config, Error}; | ||
|
||
impl<C: Config> WitnessSolver<C> { | ||
pub fn solve_witness<Cir: internal::DumpLoadTwoVariables<C::CircuitField>>( | ||
&self, | ||
assignment: &Cir, | ||
) -> Result<Witness<C>, Error> { | ||
self.solve_witness_with_hints(assignment, &mut HintRegistry::new()) | ||
} | ||
|
||
pub fn solve_witness_with_hints<Cir: internal::DumpLoadTwoVariables<C::CircuitField>>( | ||
&self, | ||
assignment: &Cir, | ||
hint_registry: &mut HintRegistry<C::CircuitField>, | ||
) -> Result<Witness<C>, Error> { | ||
let mut vars = Vec::new(); | ||
let mut public_vars = Vec::new(); | ||
assignment.dump_into(&mut vars, &mut public_vars); | ||
self.solve_witness_from_raw_inputs(vars, public_vars) | ||
self.solve_witness_from_raw_inputs(vars, public_vars, hint_registry) | ||
} | ||
|
||
pub fn solve_witnesses<Cir: internal::DumpLoadTwoVariables<C::CircuitField>>( | ||
&self, | ||
assignments: &[Cir], | ||
) -> Result<Witness<C>, Error> { | ||
self.solve_witnesses_from_raw_inputs(assignments.len(), |i| { | ||
let mut vars = Vec::new(); | ||
let mut public_vars = Vec::new(); | ||
assignments[i].dump_into(&mut vars, &mut public_vars); | ||
(vars, public_vars) | ||
}) | ||
self.solve_witnesses_with_hints(assignments, &mut HintRegistry::new()) | ||
} | ||
|
||
pub fn solve_witnesses_with_hints<Cir: internal::DumpLoadTwoVariables<C::CircuitField>>( | ||
&self, | ||
assignments: &[Cir], | ||
hint_registry: &mut HintRegistry<C::CircuitField>, | ||
) -> Result<Witness<C>, Error> { | ||
self.solve_witnesses_from_raw_inputs( | ||
assignments.len(), | ||
|i| { | ||
let mut vars = Vec::new(); | ||
let mut public_vars = Vec::new(); | ||
assignments[i].dump_into(&mut vars, &mut public_vars); | ||
(vars, public_vars) | ||
}, | ||
hint_registry, | ||
) | ||
} | ||
} |
Oops, something went wrong.