openvm_pairing_guest/pairing/final_exp.rs
1use openvm_algebra_guest::{field::FieldExtension, Field};
2use openvm_ecc_guest::AffinePoint;
3
4// Currently this is only used by VM runtime execution and not implemented for guest programs.
5#[allow(non_snake_case)]
6pub trait FinalExp {
7 type Fp: Field;
8 type Fp2: Field + FieldExtension<Self::Fp>;
9 type Fp12: Field + FieldExtension<Self::Fp2>;
10
11 /// Assert in circuit that the final exponentiation is equal to one. The actual final
12 /// exponentiaton is calculated out of circuit via final_exp_hint. Scalar coefficients
13 /// to the curve points must equal to zero, which is checked in a debug_assert.
14 fn assert_final_exp_is_one(
15 f: &Self::Fp12,
16 P: &[AffinePoint<Self::Fp>],
17 Q: &[AffinePoint<Self::Fp2>],
18 );
19
20 /// Generates a hint for the final exponentiation to be calculated out of circuit
21 /// Input is the result of the Miller loop
22 /// Output is c (residue witness inverse) and u (cubic nonresidue power)
23 fn final_exp_hint(f: &Self::Fp12) -> (Self::Fp12, Self::Fp12);
24}