From 031ae638ce459657a13ea51cfeea3704aee7f2cd Mon Sep 17 00:00:00 2001 From: Sean Bowe Date: Mon, 18 Dec 2017 22:08:57 -0700 Subject: [PATCH] Tidy up the codebase (TODOs into github issues). --- src/circuit/boolean.rs | 7 ------- src/circuit/mont.rs | 3 --- src/circuit/num.rs | 1 - src/circuit/uint32.rs | 1 - src/group_hash.rs | 1 - src/jubjub/fs.rs | 16 ---------------- src/jubjub/tests.rs | 11 +++++++++-- 7 files changed, 9 insertions(+), 31 deletions(-) diff --git a/src/circuit/boolean.rs b/src/circuit/boolean.rs index c13d9aec4..3575cf2d2 100644 --- a/src/circuit/boolean.rs +++ b/src/circuit/boolean.rs @@ -257,7 +257,6 @@ impl Boolean { where E: Engine, CS: ConstraintSystem { - // TODO: this is just a cheap hack let c = Self::xor(&mut cs, a, b)?; Self::enforce_nand(&mut cs, &[c]) @@ -351,7 +350,6 @@ impl Boolean { assert!(bits.len() > 0); let mut bits = bits.iter(); - // TODO: optimize let mut cur: Self = bits.next().unwrap().clone(); let mut i = 0; @@ -374,13 +372,11 @@ impl Boolean { { let res = Self::kary_and(&mut cs, bits)?; - // TODO: optimize match res { Boolean::Constant(false) => { Ok(()) }, Boolean::Constant(true) => { - // TODO: more descriptive error Err(SynthesisError::AssignmentMissing) }, Boolean::Is(ref res) => { @@ -457,9 +453,6 @@ impl Boolean { current_run.truncate(0); } - // TODO: this could be optimized with a k-ary operation - // (all zeros are required in the run if last_run is zero) - // If `last_run` is true, `a` must be false, or it would // not be in the field. // diff --git a/src/circuit/mont.rs b/src/circuit/mont.rs index 16e78a076..526111a36 100644 --- a/src/circuit/mont.rs +++ b/src/circuit/mont.rs @@ -44,8 +44,6 @@ impl MontgomeryPoint { assert!(tag.len() % 8 == 0); - // TODO: first block, personalization - // // Perform BLAKE2s hash let h = blake2s(cs.namespace(|| "blake2s"), tag)?; @@ -164,7 +162,6 @@ impl MontgomeryPoint { Ok(t0) }, None => { - // TODO: add a more descriptive error to bellman Err(SynthesisError::AssignmentMissing) } } diff --git a/src/circuit/num.rs b/src/circuit/num.rs index bcdb31bb3..aeda7c574 100644 --- a/src/circuit/num.rs +++ b/src/circuit/num.rs @@ -272,7 +272,6 @@ impl AllocatedNum { let tmp = *self.value.get()?; if tmp.is_zero() { - // TODO: add a more descriptive error to bellman Err(SynthesisError::AssignmentMissing) } else { Ok(tmp.inverse().unwrap()) diff --git a/src/circuit/uint32.rs b/src/circuit/uint32.rs index 7954538f5..7f93879da 100644 --- a/src/circuit/uint32.rs +++ b/src/circuit/uint32.rs @@ -180,7 +180,6 @@ impl UInt32 { }) } - // TODO: could optimize /// Perform modular addition of several `UInt32` objects. pub fn addmany( mut cs: CS, diff --git a/src/group_hash.rs b/src/group_hash.rs index cc6ed4a4d..a194d9423 100644 --- a/src/group_hash.rs +++ b/src/group_hash.rs @@ -15,7 +15,6 @@ pub fn group_hash( // Check to see that scalar field is 255 bits assert!(E::Fr::NUM_BITS == 255); - // TODO: personalization/first block let mut h = Blake2s::new_keyed(&[], 32); h.process(tag); let mut h = h.fixed_result().to_vec(); diff --git a/src/jubjub/fs.rs b/src/jubjub/fs.rs index 888660e9b..2cf6f9849 100644 --- a/src/jubjub/fs.rs +++ b/src/jubjub/fs.rs @@ -1222,19 +1222,3 @@ fn test_fs_root_of_unity() { ); assert!(Fs::multiplicative_generator().sqrt().is_none()); } - -// TODO -/* -#[test] -fn fr_field_tests() { - ::tests::field::random_field_tests::(); - ::tests::field::random_sqrt_tests::(); - ::tests::field::random_frobenius_tests::(Fr::char(), 13); - ::tests::field::from_str_tests::(); -} - -#[test] -fn fr_repr_tests() { - ::tests::repr::random_repr_tests::(); -} -*/ diff --git a/src/jubjub/tests.rs b/src/jubjub/tests.rs index c26bbe7ae..a105f32e2 100644 --- a/src/jubjub/tests.rs +++ b/src/jubjub/tests.rs @@ -1,8 +1,15 @@ -// TODO -use super::*; +use super::{ + JubjubEngine, + JubjubParams, + PrimeOrder, + montgomery, + edwards +}; use pairing::{ Field, + PrimeField, + SqrtField, LegendreSymbol };