mirror of
https://github.com/Qortal/pirate-librustzcash.git
synced 2025-02-07 23:02:59 +00:00
Merge pull request #13 from ebfull/tidy-up
Tidy up the codebase (TODOs into github issues)
This commit is contained in:
commit
041060e5ca
@ -257,7 +257,6 @@ impl<Var: Copy> Boolean<Var> {
|
|||||||
where E: Engine,
|
where E: Engine,
|
||||||
CS: ConstraintSystem<E, Variable=Var>
|
CS: ConstraintSystem<E, Variable=Var>
|
||||||
{
|
{
|
||||||
// TODO: this is just a cheap hack
|
|
||||||
let c = Self::xor(&mut cs, a, b)?;
|
let c = Self::xor(&mut cs, a, b)?;
|
||||||
|
|
||||||
Self::enforce_nand(&mut cs, &[c])
|
Self::enforce_nand(&mut cs, &[c])
|
||||||
@ -351,7 +350,6 @@ impl<Var: Copy> Boolean<Var> {
|
|||||||
assert!(bits.len() > 0);
|
assert!(bits.len() > 0);
|
||||||
let mut bits = bits.iter();
|
let mut bits = bits.iter();
|
||||||
|
|
||||||
// TODO: optimize
|
|
||||||
let mut cur: Self = bits.next().unwrap().clone();
|
let mut cur: Self = bits.next().unwrap().clone();
|
||||||
|
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
@ -374,13 +372,11 @@ impl<Var: Copy> Boolean<Var> {
|
|||||||
{
|
{
|
||||||
let res = Self::kary_and(&mut cs, bits)?;
|
let res = Self::kary_and(&mut cs, bits)?;
|
||||||
|
|
||||||
// TODO: optimize
|
|
||||||
match res {
|
match res {
|
||||||
Boolean::Constant(false) => {
|
Boolean::Constant(false) => {
|
||||||
Ok(())
|
Ok(())
|
||||||
},
|
},
|
||||||
Boolean::Constant(true) => {
|
Boolean::Constant(true) => {
|
||||||
// TODO: more descriptive error
|
|
||||||
Err(SynthesisError::AssignmentMissing)
|
Err(SynthesisError::AssignmentMissing)
|
||||||
},
|
},
|
||||||
Boolean::Is(ref res) => {
|
Boolean::Is(ref res) => {
|
||||||
@ -457,9 +453,6 @@ impl<Var: Copy> Boolean<Var> {
|
|||||||
current_run.truncate(0);
|
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
|
// If `last_run` is true, `a` must be false, or it would
|
||||||
// not be in the field.
|
// not be in the field.
|
||||||
//
|
//
|
||||||
|
@ -44,8 +44,6 @@ impl<E: JubjubEngine, Var: Copy> MontgomeryPoint<E, Var> {
|
|||||||
|
|
||||||
assert!(tag.len() % 8 == 0);
|
assert!(tag.len() % 8 == 0);
|
||||||
|
|
||||||
// TODO: first block, personalization
|
|
||||||
//
|
|
||||||
// Perform BLAKE2s hash
|
// Perform BLAKE2s hash
|
||||||
let h = blake2s(cs.namespace(|| "blake2s"), tag)?;
|
let h = blake2s(cs.namespace(|| "blake2s"), tag)?;
|
||||||
|
|
||||||
@ -164,7 +162,6 @@ impl<E: JubjubEngine, Var: Copy> MontgomeryPoint<E, Var> {
|
|||||||
Ok(t0)
|
Ok(t0)
|
||||||
},
|
},
|
||||||
None => {
|
None => {
|
||||||
// TODO: add a more descriptive error to bellman
|
|
||||||
Err(SynthesisError::AssignmentMissing)
|
Err(SynthesisError::AssignmentMissing)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,6 @@ impl<E: Engine, Var: Copy> AllocatedNum<E, Var> {
|
|||||||
let tmp = *self.value.get()?;
|
let tmp = *self.value.get()?;
|
||||||
|
|
||||||
if tmp.is_zero() {
|
if tmp.is_zero() {
|
||||||
// TODO: add a more descriptive error to bellman
|
|
||||||
Err(SynthesisError::AssignmentMissing)
|
Err(SynthesisError::AssignmentMissing)
|
||||||
} else {
|
} else {
|
||||||
Ok(tmp.inverse().unwrap())
|
Ok(tmp.inverse().unwrap())
|
||||||
|
@ -180,7 +180,6 @@ impl<Var: Copy> UInt32<Var> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: could optimize
|
|
||||||
/// Perform modular addition of several `UInt32` objects.
|
/// Perform modular addition of several `UInt32` objects.
|
||||||
pub fn addmany<E, CS>(
|
pub fn addmany<E, CS>(
|
||||||
mut cs: CS,
|
mut cs: CS,
|
||||||
|
@ -15,7 +15,6 @@ pub fn group_hash<E: JubjubEngine>(
|
|||||||
// Check to see that scalar field is 255 bits
|
// Check to see that scalar field is 255 bits
|
||||||
assert!(E::Fr::NUM_BITS == 255);
|
assert!(E::Fr::NUM_BITS == 255);
|
||||||
|
|
||||||
// TODO: personalization/first block
|
|
||||||
let mut h = Blake2s::new_keyed(&[], 32);
|
let mut h = Blake2s::new_keyed(&[], 32);
|
||||||
h.process(tag);
|
h.process(tag);
|
||||||
let mut h = h.fixed_result().to_vec();
|
let mut h = h.fixed_result().to_vec();
|
||||||
|
@ -1222,19 +1222,3 @@ fn test_fs_root_of_unity() {
|
|||||||
);
|
);
|
||||||
assert!(Fs::multiplicative_generator().sqrt().is_none());
|
assert!(Fs::multiplicative_generator().sqrt().is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
|
||||||
/*
|
|
||||||
#[test]
|
|
||||||
fn fr_field_tests() {
|
|
||||||
::tests::field::random_field_tests::<Fr>();
|
|
||||||
::tests::field::random_sqrt_tests::<Fr>();
|
|
||||||
::tests::field::random_frobenius_tests::<Fr, _>(Fr::char(), 13);
|
|
||||||
::tests::field::from_str_tests::<Fr>();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn fr_repr_tests() {
|
|
||||||
::tests::repr::random_repr_tests::<FsRepr>();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
@ -1,8 +1,15 @@
|
|||||||
// TODO
|
use super::{
|
||||||
use super::*;
|
JubjubEngine,
|
||||||
|
JubjubParams,
|
||||||
|
PrimeOrder,
|
||||||
|
montgomery,
|
||||||
|
edwards
|
||||||
|
};
|
||||||
|
|
||||||
use pairing::{
|
use pairing::{
|
||||||
Field,
|
Field,
|
||||||
|
PrimeField,
|
||||||
|
SqrtField,
|
||||||
LegendreSymbol
|
LegendreSymbol
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user