Skip to content

Commit

Permalink
ec: small refactor on pairing (#899)
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoratger authored Nov 30, 2024
1 parent e741880 commit afc19c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
7 changes: 2 additions & 5 deletions curves/curve-constraint-tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub mod fields {
AllocationMode::Constant,
];
for &mode in &modes {
let cs = ConstraintSystem::<ConstraintF>::new_ref();
let cs = ConstraintSystem::new_ref();

let mut rng = test_rng();
let a_native = F::rand(&mut rng);
Expand Down Expand Up @@ -152,10 +152,7 @@ pub mod fields {
for c in &mut constants {
*c = UniformRand::rand(&mut test_rng());
}
let bits = [
Boolean::<ConstraintF>::constant(false),
Boolean::constant(true),
];
let bits = [Boolean::constant(false), Boolean::constant(true)];
let lookup_result = AF::two_bit_lookup(&bits, constants.as_ref())?;
assert_eq!(lookup_result.value()?, constants[2]);
assert!(cs.is_satisfied().unwrap());
Expand Down
6 changes: 2 additions & 4 deletions ec/src/pairing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,10 @@ impl<P: Pairing> Mul<P::ScalarField> for MillerLoopOutput<P> {

/// Preprocesses a G1 element for use in a pairing.
pub fn prepare_g1<E: Pairing>(g: impl Into<E::G1Affine>) -> E::G1Prepared {
let g: E::G1Affine = g.into();
E::G1Prepared::from(g)
E::G1Prepared::from(g.into())
}

/// Preprocesses a G2 element for use in a pairing.
pub fn prepare_g2<E: Pairing>(g: impl Into<E::G2Affine>) -> E::G2Prepared {
let g: E::G2Affine = g.into();
E::G2Prepared::from(g)
E::G2Prepared::from(g.into())
}

0 comments on commit afc19c0

Please sign in to comment.