diff --git a/Cargo.lock b/Cargo.lock index dca378c4..4683d9cb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1032,7 +1032,7 @@ dependencies = [ [[package]] name = "c-kzg" version = "1.0.2" -source = "git+https://github.com/ethereum/c-kzg-4844?branch=das#9d86b5403e281bfeec3759e2b3284ef55c1abb7f" +source = "git+https://github.com/ethereum/c-kzg-4844?branch=das#4ad278fafb4428373174ff75499b13212996b581" dependencies = [ "blst", "cc", diff --git a/eip_7594/src/lib.rs b/eip_7594/src/lib.rs index 9e4c1baa..b3795ffa 100644 --- a/eip_7594/src/lib.rs +++ b/eip_7594/src/lib.rs @@ -80,23 +80,21 @@ pub fn verify_kzg_proofs(data_column_sidecar: &DataColumnSidecar

) } ); - let mut row_ids = Vec::new(); - for i in 0..column.len() { - row_ids.push(i as u64); - } + let (row_indices, col_indices): (Vec<_>, Vec<_>) = column + .iter() + .zip(0_u64..) + .map(|(_, row_index)| (row_index, index)) + .unzip(); let kzg_settings = load_kzg_settings()?; - // let trusted_setup_file = std::path::Path::new("../kzg_utils/src/trusted_setup.txt"); - // let kzg_settings = KzgSettings::load_trusted_setup_file(trusted_setup_file).unwrap(); - let column = column .clone() .into_iter() .map(|a| CKzgCell::from_bytes(a.as_bytes()).map_err(Into::into)) .collect::>>()?; - let commitment = kzg_commitments + let commitments = kzg_commitments .iter() .map(|a| Bytes48::from_bytes(a.as_bytes()).map_err(Into::into)) .collect::>>()?; @@ -106,11 +104,11 @@ pub fn verify_kzg_proofs(data_column_sidecar: &DataColumnSidecar

) .map(|a| Bytes48::from_bytes(&a.as_bytes()).map_err(Into::into)) .collect::>>()?; - Ok(CKzgProof::verify_cell_proof_batch( - commitment.as_slice(), - &row_ids, - &[*index], - &column[..], + Ok(CKzgProof::verify_cell_kzg_proof_batch( + commitments.as_slice(), + &row_indices, + &col_indices, + column.as_slice(), &kzg_proofs, &kzg_settings, )?) @@ -203,6 +201,7 @@ pub fn compute_extended_matrix(blobs: Vec) -> Result { Ok(array) } +/* fn recover_matrix( cells_dict: &HashMap<(BlobIndex, CellID), CKzgCell>, blob_count: usize, @@ -221,7 +220,7 @@ fn recover_matrix( .iter() .map(|&cell_id| cells_dict[&(blob_index as u64, cell_id)]) .collect(); - let full_polynomial = CKzgCell::recover_polynomial(&cell_ids, &cells, &kzg_settings)?; + let full_polynomial = CKzgCell::recover_all_cells(&cell_ids, &cells, &kzg_settings)?; extended_matrix.push(full_polynomial); } let mut array = [CKzgCell::default(); (MAX_BLOBS_PER_BLOCK * NumberOfColumns::U64) as usize]; @@ -255,7 +254,7 @@ pub fn get_data_column_sidecars( let cells_and_proofs = c_kzg_blobs .into_iter() .map(|blob| { - CKzgCell::compute_cells_and_proofs(&blob, &kzg_settings).map_err(Into::into) + CKzgCell::compute_cells_and_kzg_proofs(&blob, &kzg_settings).map_err(Into::into) }) .collect::>>()?; @@ -304,6 +303,7 @@ pub fn get_data_column_sidecars( Ok(vec![]) } +*/ fn kzg_commitment_inclusion_proof( body: &(impl PostDenebBeaconBlockBody

+ ?Sized), @@ -356,6 +356,7 @@ fn load_kzg_settings() -> Result { .chunks_exact(BYTES_PER_G2) .map(|chunk| TryInto::<[u8; BYTES_PER_G2]>::try_into(chunk).map_err(Into::into)) .collect::>>()?, + 0, ) .map_err(|error| anyhow!(error)) }