use field eq method

This commit is contained in:
collin 2021-05-17 16:32:44 -07:00
parent d24623d9d2
commit abeb796cbb

View File

@ -242,14 +242,13 @@ impl<F: PrimeField> EvaluateEqGadget<F> for FieldType<F> {
fn evaluate_equal<CS: ConstraintSystem<F>>(&self, mut _cs: CS, other: &Self) -> Result<Boolean, SynthesisError> { fn evaluate_equal<CS: ConstraintSystem<F>>(&self, mut _cs: CS, other: &Self) -> Result<Boolean, SynthesisError> {
match (self, other) { match (self, other) {
(FieldType::Constant(first), FieldType::Constant(second)) => Ok(Boolean::constant(first.eq(second))), (FieldType::Constant(first), FieldType::Constant(second)) => Ok(Boolean::constant(first.eq(second))),
_ => unimplemented!(), _ => unimplemented!("field equality not implemented yet"), // (FieldType::Allocated(first), FieldType::Allocated(second)) => first.is_eq(cs, second),
// (FieldType::Allocated(first), FieldType::Allocated(second)) => first.evaluate_equal(cs, second), // (FieldType::Constant(constant_value), FieldType::Allocated(allocated_value))
// (FieldType::Constant(constant_value), FieldType::Allocated(allocated_value)) // | (FieldType::Allocated(allocated_value), FieldType::Constant(constant_value)) => {
// | (FieldType::Allocated(allocated_value), FieldType::Constant(constant_value)) => { // let allocated_constant_value =
// let allocated_constant_value = // FpGadget::alloc(&mut cs.ns(|| format!("alloc constant for eq")), || Ok(constant_value))?;
// FpGadget::alloc(&mut cs.ns(|| format!("alloc constant for eq")), || Ok(constant_value))?; // allocated_value.is_eq(cs, &allocated_constant_value)
// allocated_value.evaluate_equal(cs, &allocated_constant_value) // }
// }
} }
} }
} }