Remove empty blob handling as it's handled in kzg library

This commit is contained in:
Pawan Dhananjay 2022-11-29 15:15:00 +05:30
parent e548073602
commit 0ed3f7474c
No known key found for this signature in database
GPG Key ID: 647E56278D7E9B4C

View File

@ -19,8 +19,6 @@ pub enum Error {
InvalidKzgCommitment(CKzgError), InvalidKzgCommitment(CKzgError),
InvalidKzgProof(CKzgError), InvalidKzgProof(CKzgError),
KzgVerificationFailed(CKzgError), KzgVerificationFailed(CKzgError),
EmptyBlobs,
EmptyKzgCommitments,
InvalidLength(String), InvalidLength(String),
KzgProofComputationFailed(CKzgError), KzgProofComputationFailed(CKzgError),
} }
@ -39,9 +37,6 @@ impl Kzg {
} }
pub fn compute_aggregate_kzg_proof(&self, blobs: &[Blob]) -> Result<KzgProof, Error> { pub fn compute_aggregate_kzg_proof(&self, blobs: &[Blob]) -> Result<KzgProof, Error> {
if blobs.len() == 0 {
return Err(Error::EmptyBlobs);
}
c_kzg::KZGProof::compute_aggregate_kzg_proof(blobs, &self.trusted_setup) c_kzg::KZGProof::compute_aggregate_kzg_proof(blobs, &self.trusted_setup)
.map_err(Error::KzgProofComputationFailed) .map_err(Error::KzgProofComputationFailed)
.map(|proof| KzgProof(proof.to_bytes())) .map(|proof| KzgProof(proof.to_bytes()))
@ -53,12 +48,6 @@ impl Kzg {
expected_kzg_commitments: &[KzgCommitment], expected_kzg_commitments: &[KzgCommitment],
kzg_aggregated_proof: KzgProof, kzg_aggregated_proof: KzgProof,
) -> Result<bool, Error> { ) -> Result<bool, Error> {
if blobs.len() == 0 {
return Err(Error::EmptyBlobs);
}
if expected_kzg_commitments.len() == 0 {
return Err(Error::EmptyBlobs);
}
if blobs.len() != expected_kzg_commitments.len() { if blobs.len() != expected_kzg_commitments.len() {
return Err(Error::InvalidLength( return Err(Error::InvalidLength(
"blobs and expected_kzg_commitments should be of same size".to_string(), "blobs and expected_kzg_commitments should be of same size".to_string(),