mirror of https://github.com/zcash/mpc.git
Rearrange CS constructor.
This commit is contained in:
parent
a487c8a2d8
commit
d5414d7c3f
|
@ -74,6 +74,21 @@ pub struct CS {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CS {
|
impl CS {
|
||||||
|
pub fn dummy() -> Self {
|
||||||
|
let mut d = 0;
|
||||||
|
let mut vars = 0;
|
||||||
|
let mut o = Fr::zero();
|
||||||
|
|
||||||
|
let cs = unsafe { libsnarkwrap_getcs(&mut d, &mut vars, &mut o) };
|
||||||
|
|
||||||
|
CS {
|
||||||
|
ptr: cs,
|
||||||
|
num_vars: vars as usize,
|
||||||
|
d: d as usize,
|
||||||
|
omega: o
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn test_compare_tau(&self, v1: &[G1], v2: &[G2], tau: &Fr) -> bool {
|
pub fn test_compare_tau(&self, v1: &[G1], v2: &[G2], tau: &Fr) -> bool {
|
||||||
assert_eq!(v1.len(), v2.len());
|
assert_eq!(v1.len(), v2.len());
|
||||||
unsafe { libsnarkwrap_test_compare_tau(&v1[0], &v2[0], tau, v1.len() as u64, self.ptr) }
|
unsafe { libsnarkwrap_test_compare_tau(&v1[0], &v2[0], tau, v1.len() as u64, self.ptr) }
|
||||||
|
@ -127,22 +142,6 @@ impl Drop for CS {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the QAP info for the generation routines
|
|
||||||
pub fn getcs() -> CS {
|
|
||||||
let mut d = 0;
|
|
||||||
let mut vars = 0;
|
|
||||||
let mut o = Fr::zero();
|
|
||||||
|
|
||||||
let cs = unsafe { libsnarkwrap_getcs(&mut d, &mut vars, &mut o) };
|
|
||||||
|
|
||||||
CS {
|
|
||||||
ptr: cs,
|
|
||||||
num_vars: vars as usize,
|
|
||||||
d: d as usize,
|
|
||||||
omega: o
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub trait Pairing<Other: Group> {
|
pub trait Pairing<Other: Group> {
|
||||||
fn g1<'a>(&'a self, other: &'a Other) -> &'a G1;
|
fn g1<'a>(&'a self, other: &'a Other) -> &'a G1;
|
||||||
fn g2<'a>(&'a self, other: &'a Other) -> &'a G2;
|
fn g2<'a>(&'a self, other: &'a Other) -> &'a G2;
|
||||||
|
|
|
@ -86,7 +86,7 @@ mod test {
|
||||||
initialize();
|
initialize();
|
||||||
|
|
||||||
// Get the QAP degree and omega (for FFT evaluation)
|
// Get the QAP degree and omega (for FFT evaluation)
|
||||||
let cs = getcs();
|
let cs = CS::dummy();
|
||||||
|
|
||||||
// Sample a random tau
|
// Sample a random tau
|
||||||
let tau = Fr::random();
|
let tau = Fr::random();
|
||||||
|
|
Loading…
Reference in New Issue