should allow to evaluate for domain that is up to 2^roots of unity
@@ -55,6 +55,24 @@ impl<E: Engine, G: Group<E>> EvaluationDomain<E, G> {
let mut exp = 0;
println!("Polynomial degree = {}", coeffs.len());
println!("Max polynomial degree = {}", (1 << E::Fr::S) - 1);
+
+ let max_degree = (1 << E::Fr::S) - 1;
+
+ let coeffs_len = coeffs.len();
+
+ // Compute omega, the 2^exp primitive root of unity
+ let mut omega = E::Fr::root_of_unity();
+
+ // find power of two that is larger or equal to the number of
+ // constraints
+
+ if coeffs_len > max_degree {
+ return Err(SynthesisError::PolynomialDegreeTooLarge)
+ }
+
+ if coeffs_len >= 1 << (E::Fr::S - 1) {
+ m = 1 << E::Fr::S;
+ } else {
while m < coeffs.len() {
m *= 2;
exp += 1;
@@ -66,11 +84,10 @@ impl<E: Engine, G: Group<E>> EvaluationDomain<E, G> {
}
}
- // Compute omega, the 2^exp primitive root of unity
- let mut omega = E::Fr::root_of_unity();
for _ in exp..E::Fr::S {
omega.square();
}
+ }
// Extend the coeffs vector with zeroes if necessary
coeffs.resize(m, G::group_zero());
