diff --git a/nomos-da/kzgrs-backend/src/dispersal.rs b/nomos-da/kzgrs-backend/src/dispersal.rs index fe2ba7ff..c3fc117d 100644 --- a/nomos-da/kzgrs-backend/src/dispersal.rs +++ b/nomos-da/kzgrs-backend/src/dispersal.rs @@ -221,10 +221,8 @@ impl AsRef<[u8]> for Index { #[cfg(test)] mod tests { - use ark_poly::EvaluationDomain; use bitvec::prelude::*; use blst::min_sig::{PublicKey, SecretKey}; - use kzgrs::PolynomialEvaluationDomain; use rand::{rngs::OsRng, thread_rng, Rng, RngCore}; use crate::{ @@ -252,8 +250,7 @@ mod tests { verifiers: &[DaVerifier], ) -> Vec { let mut attestations = Vec::new(); - let domain = - PolynomialEvaluationDomain::new(encoded_data.extended_data.0[0].len()).unwrap(); + let domain_size = encoded_data.extended_data.0[0].len(); for (i, column) in encoded_data.extended_data.columns().enumerate() { let verifier = &verifiers[i]; let da_blob = DaBlob { @@ -268,7 +265,7 @@ mod tests { .map(|proofs| proofs.get(i).cloned().unwrap()) .collect(), }; - attestations.push(verifier.verify(da_blob, domain).unwrap()); + attestations.push(verifier.verify(da_blob, domain_size).unwrap()); } attestations } diff --git a/nomos-da/kzgrs-backend/src/verifier.rs b/nomos-da/kzgrs-backend/src/verifier.rs index 861478d4..fe6f118c 100644 --- a/nomos-da/kzgrs-backend/src/verifier.rs +++ b/nomos-da/kzgrs-backend/src/verifier.rs @@ -134,11 +134,9 @@ impl DaVerifier { } } - pub fn verify( - &self, - blob: DaBlob, - rows_domain: PolynomialEvaluationDomain, - ) -> Option { + pub fn verify(&self, blob: DaBlob, rows_domain_size: usize) -> Option { + let rows_domain = PolynomialEvaluationDomain::new(rows_domain_size) + .expect("Domain should be able to build"); let is_column_verified = DaVerifier::verify_column( &blob.column, &blob.column_commitment, @@ -176,8 +174,7 @@ mod test { use ark_poly::{EvaluationDomain, GeneralEvaluationDomain}; use blst::min_sig::SecretKey; use kzgrs::{ - bytes_to_polynomial, commit_polynomial, generate_element_proof, PolynomialEvaluationDomain, - BYTES_PER_FIELD_ELEMENT, + bytes_to_polynomial, commit_polynomial, generate_element_proof, BYTES_PER_FIELD_ELEMENT, }; use rand::{thread_rng, RngCore}; @@ -224,7 +221,7 @@ mod test { fn test_verify() { let encoder = &ENCODER; let data = rand_data(32); - let domain = PolynomialEvaluationDomain::new(16).unwrap(); + let domain_size = 16usize; let mut rng = thread_rng(); let sks: Vec = (0..16) .map(|_| { @@ -254,7 +251,7 @@ mod test { .map(|proofs| proofs.get(i).cloned().unwrap()) .collect(), }; - assert!(verifier.verify(da_blob, domain).is_some()); + assert!(verifier.verify(da_blob, domain_size).is_some()); } } } diff --git a/nomos-services/data-availability/verifier/src/backend/kzgrs.rs b/nomos-services/data-availability/verifier/src/backend/kzgrs.rs index f8dc8f09..736ea105 100644 --- a/nomos-services/data-availability/verifier/src/backend/kzgrs.rs +++ b/nomos-services/data-availability/verifier/src/backend/kzgrs.rs @@ -45,7 +45,10 @@ impl DaVerifier for KzgrsDaVerifier { fn verify(&self, blob: &Self::DaBlob) -> Result { let blob = blob.clone(); - match self.verifier.verify(blob) { + // TODO: Prepare the domain depending the size, if fixed, so fixed domain, if not it needs + // to come with some metadata. + let domain_size = 4096usize; + match self.verifier.verify(blob, domain_size) { Some(attestation) => Ok(attestation), None => Err(KzgrsDaVerifierError::VerificationError), }