diff --git a/src/kzg.rs b/src/kzg.rs index ef749a4..6caad4e 100644 --- a/src/kzg.rs +++ b/src/kzg.rs @@ -45,6 +45,10 @@ impl KZG { /// Commits to a polynomial. pub fn commit(&self, p: &[E::ScalarField]) -> Result { + if p.len() > self.g1_pow.len() { + return Err(KZGError::PolynomialTooLarge(p.len(), self.g1_pow.len())); + } + let mut commitment = E::G1::zero(); // commitment = sum(p[i] * g1_powers[i])