-
Notifications
You must be signed in to change notification settings - Fork 209
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
r1cs replaced with gr1cs #378
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some changes
|
||
/////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
/// An Rank-One `ConstraintSystem`. Enforces constraints of the form |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// An Rank-One `ConstraintSystem`. Enforces constraints of the form | |
/// A Rank-1 `ConstraintSystem`. Enforces constraints of the form |
/// An Rank-One `ConstraintSystem`. Enforces constraints of the form | ||
/// `L_i(⟨M_{i,1}, z⟩ , ⟨M_{i,2}, z⟩ , ..., ⟨M_{i,t_i}, z⟩)=0`, where L_i is a | ||
/// local predicate, and `M_{i,j}`s are linear combinations over variables, and | ||
/// `z` is the concrete assignment to these variables. refer to //TODO: Paper Url |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix url
)?; | ||
} | ||
self.enforce_constraint(R1CS_PREDICATE_LABEL, vec![a, b, c]) | ||
// if self.should_construct_matrices() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo fix tracing
/// Add a new vector of linear combinations to the constraint system. | ||
pub fn new_lc_vec( | ||
&mut self, | ||
lc_vec: Vec<LinearCombination<F>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lc_vec: Vec<LinearCombination<F>>, | |
lc_vec: impl IntoIterator<Item = LinearCombination<F>>, |
I can pass in [lc_1, lc_2, lc_3]
, or I can pass in vec![lc_1, lc_2, lc_3]
. The benefit is that this avoids allocations
let mut constraints: Constraint = Vec::new(); | ||
for lc in lc_vec { | ||
let var = self.new_lc(lc)?; | ||
match var { | ||
Variable::SymbolicLc(index) => constraints.push(index), | ||
_ => return Err(SynthesisError::UnexpectedVariable), | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let mut constraints: Constraint = Vec::new(); | |
for lc in lc_vec { | |
let var = self.new_lc(lc)?; | |
match var { | |
Variable::SymbolicLc(index) => constraints.push(index), | |
_ => return Err(SynthesisError::UnexpectedVariable), | |
} | |
} | |
let constraints: Vec<_> = lc_vec.into_iter().map(|lc| { | |
let var = self.new_lc(lc)?; | |
match var { | |
Variable::SymbolicLc(index) => constraints.push(index), | |
_ => return Err(SynthesisError::UnexpectedVariable), | |
} | |
}).collect(); |
.predicate_traces | ||
.get(label) | ||
.unwrap() | ||
.get(unsatisfied_constraint) | ||
.unwrap() | ||
.as_ref() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.predicate_traces | |
.get(label) | |
.unwrap() | |
.get(unsatisfied_constraint) | |
.unwrap() | |
.as_ref() | |
.predicate_traces[&label][unsatisfied_constraint] | |
.as_ref() |
format!("{} - {}", label.clone(), unsatisfied_constraint) | ||
}, | ||
|t| format!("{}", t), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
format!("{} - {}", label.clone(), unsatisfied_constraint) | |
}, | |
|t| format!("{}", t), | |
format!("{} - {unsatisfied_constraint}", &label) | |
}, | |
|t| format!("{t}"), |
use lookup_constraint::LookupConstraint; | ||
use polynomial_constraint::PolynomialConstraint; | ||
|
||
// use crate::{gr1cs::ConstraintSystemRef, utils::Result}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// use crate::{gr1cs::ConstraintSystemRef, utils::Result}; |
where | ||
PolynomialConstraint<F>: Evaluatable<F>, | ||
LookupConstraint<F>: Evaluatable<F>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where | |
PolynomialConstraint<F>: Evaluatable<F>, | |
LookupConstraint<F>: Evaluatable<F>, |
pub trait Evaluatable<F> { | ||
fn evaluate(&self, point: Vec<F>) -> F; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add documentation for trait, and change point
to variables
Description
This is a major refactor for migrating to GR1CS infrastructure
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
Pending
section inCHANGELOG.md
Files changed
in the Github PR explorer