From 8331583a3cbd8c09f08f4048701e061f64e2f94b Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Mon, 17 Jun 2024 17:49:39 +0100 Subject: [PATCH 01/23] chore: add recover_cells_and_compute_proofs method --- consensus/types/src/data_column_sidecar.rs | 10 +--------- crypto/kzg/src/lib.rs | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/consensus/types/src/data_column_sidecar.rs b/consensus/types/src/data_column_sidecar.rs index 74f9a9b4223..9c97ac9c6ef 100644 --- a/consensus/types/src/data_column_sidecar.rs +++ b/consensus/types/src/data_column_sidecar.rs @@ -226,15 +226,7 @@ impl DataColumnSidecar { cells.push(ssz_cell_to_crypto_cell::(cell)?); cell_ids.push(data_column.index); } - // recover_all_cells does not expect sorted - let all_cells = kzg.recover_all_cells(&cell_ids, &cells)?; - let blob = kzg.cells_to_blob(&all_cells)?; - - // Note: This function computes all cells and proofs. According to Justin this is okay, - // computing a partial set may be more expensive and requires code paths that don't exist. - // Computing the blobs cells is technically unnecessary but very cheap. It's done here again - // for simplicity. - kzg.compute_cells_and_proofs(&blob) + kzg.recover_cells_and_compute_kzg_proofs(&cell_ids, &cells) }) .collect::, KzgError>>()?; diff --git a/crypto/kzg/src/lib.rs b/crypto/kzg/src/lib.rs index e41345e7046..5011d55291e 100644 --- a/crypto/kzg/src/lib.rs +++ b/crypto/kzg/src/lib.rs @@ -196,20 +196,24 @@ impl Kzg { } } - pub fn cells_to_blob(&self, cells: &[Cell; c_kzg::CELLS_PER_EXT_BLOB]) -> Result { + fn cells_to_blob(&self, cells: &[Cell; c_kzg::CELLS_PER_EXT_BLOB]) -> Result { Ok(Blob::cells_to_blob(cells)?) } - pub fn recover_all_cells( + pub fn recover_cells_and_compute_kzg_proofs( &self, cell_ids: &[u64], cells: &[Cell], - ) -> Result, Error> { - Ok(c_kzg::Cell::recover_all_cells( - cell_ids, - cells, - &self.trusted_setup, - )?) + ) -> Result< + ( + Box<[Cell; CELLS_PER_EXT_BLOB]>, + Box<[KzgProof; CELLS_PER_EXT_BLOB]>, + ), + Error, + > { + let all_cells = c_kzg::Cell::recover_all_cells(cell_ids, cells, &self.trusted_setup)?; + let blob = self.cells_to_blob(&all_cells)?; + self.compute_cells_and_proofs(&blob) } } From f84bbde3d799ab68a7170ece52d424f1a2165d3d Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Mon, 17 Jun 2024 19:22:47 +0100 Subject: [PATCH 02/23] chore: add rust peerdas crypto library --- Cargo.lock | 192 +++++++++++++++++++++++++++++++++++++++++++++++++++-- Cargo.toml | 1 + 2 files changed, 187 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 222f97fad89..fe16be5cf1b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1043,6 +1043,22 @@ dependencies = [ "zeroize", ] +[[package]] +name = "blstrs" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a8a8ed6fefbeef4a8c7b460e4110e12c5e22a5b7cf32621aae6ad650c4dcf29" +dependencies = [ + "blst", + "byte-slice-cast", + "ff 0.13.0", + "group 0.13.0", + "pairing", + "rand_core", + "serde", + "subtle", +] + [[package]] name = "bollard-stubs" version = "1.42.0-rc.3" @@ -1515,6 +1531,47 @@ dependencies = [ "libc", ] +[[package]] +name = "crate_crypto_internal_peerdas_bls12_381" +version = "0.3.0" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=8bafeda8d969cf8c8887aab2eaf3ccba37201abf#8bafeda8d969cf8c8887aab2eaf3ccba37201abf" +dependencies = [ + "blst", + "blstrs", + "ff 0.13.0", + "group 0.13.0", + "pairing", + "rayon", +] + +[[package]] +name = "crate_crypto_internal_peerdas_erasure_codes" +version = "0.3.0" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=8bafeda8d969cf8c8887aab2eaf3ccba37201abf#8bafeda8d969cf8c8887aab2eaf3ccba37201abf" +dependencies = [ + "crate_crypto_internal_peerdas_bls12_381", + "crate_crypto_internal_peerdas_polynomial", +] + +[[package]] +name = "crate_crypto_internal_peerdas_polynomial" +version = "0.3.0" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=8bafeda8d969cf8c8887aab2eaf3ccba37201abf#8bafeda8d969cf8c8887aab2eaf3ccba37201abf" +dependencies = [ + "crate_crypto_internal_peerdas_bls12_381", +] + +[[package]] +name = "crate_crypto_kzg_multi_open_fk20" +version = "0.3.0" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=8bafeda8d969cf8c8887aab2eaf3ccba37201abf#8bafeda8d969cf8c8887aab2eaf3ccba37201abf" +dependencies = [ + "crate_crypto_internal_peerdas_bls12_381", + "crate_crypto_internal_peerdas_polynomial", + "hex", + "rayon", +] + [[package]] name = "crc32fast" version = "1.4.0" @@ -2214,6 +2271,21 @@ dependencies = [ "types", ] +[[package]] +name = "eip7594" +version = "0.3.0" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=8bafeda8d969cf8c8887aab2eaf3ccba37201abf#8bafeda8d969cf8c8887aab2eaf3ccba37201abf" +dependencies = [ + "crate_crypto_internal_peerdas_bls12_381", + "crate_crypto_internal_peerdas_erasure_codes", + "crate_crypto_kzg_multi_open_fk20", + "hex", + "rayon", + "rust-embed", + "serde", + "serde_json", +] + [[package]] name = "either" version = "1.11.0" @@ -2982,6 +3054,7 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" dependencies = [ + "bitvec 1.0.1", "rand_core", "subtle", ] @@ -3422,7 +3495,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" dependencies = [ "ff 0.13.0", + "rand", "rand_core", + "rand_xorshift", "subtle", ] @@ -4060,6 +4135,40 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "include-flate" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2e11569346406931d20276cc460215ee2826e7cad43aa986999cb244dd7adb0" +dependencies = [ + "include-flate-codegen-exports", + "lazy_static", + "libflate 1.4.0", +] + +[[package]] +name = "include-flate-codegen" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a7d6e1419fa3129eb0802b4c99603c0d425c79fb5d76191d5a20d0ab0d664e8" +dependencies = [ + "libflate 1.4.0", + "proc-macro-hack", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "include-flate-codegen-exports" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75657043ffe3d8280f1cb8aef0f505532b392ed7758e0baeac22edadcee31a03" +dependencies = [ + "include-flate-codegen", + "proc-macro-hack", +] + [[package]] name = "indenter" version = "0.3.3" @@ -4306,6 +4415,7 @@ dependencies = [ "arbitrary", "c-kzg", "derivative", + "eip7594", "ethereum_hashing", "ethereum_serde_utils", "ethereum_ssz", @@ -4395,6 +4505,17 @@ version = "0.2.154" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" +[[package]] +name = "libflate" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ff4ae71b685bbad2f2f391fe74f6b7659a34871c08b210fdc039e43bee07d18" +dependencies = [ + "adler32", + "crc32fast", + "libflate_lz77 1.2.0", +] + [[package]] name = "libflate" version = "2.1.0" @@ -4405,7 +4526,16 @@ dependencies = [ "core2", "crc32fast", "dary_heap", - "libflate_lz77", + "libflate_lz77 2.1.0", +] + +[[package]] +name = "libflate_lz77" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a52d3a8bfc85f250440e4424db7d857e241a3aebbbe301f3eb606ab15c39acbf" +dependencies = [ + "rle-decode-fast", ] [[package]] @@ -5909,6 +6039,15 @@ dependencies = [ "sha2 0.10.8", ] +[[package]] +name = "pairing" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fec4625e73cf41ef4bb6846cafa6d44736525f442ba45e407c4a000a13996f" +dependencies = [ + "group 0.13.0", +] + [[package]] name = "parity-scale-codec" version = "2.3.1" @@ -6419,6 +6558,12 @@ dependencies = [ "toml_edit 0.20.7", ] +[[package]] +name = "proc-macro-hack" +version = "0.5.20+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" + [[package]] name = "proc-macro2" version = "1.0.81" @@ -7057,6 +7202,41 @@ dependencies = [ "smallvec", ] +[[package]] +name = "rust-embed" +version = "8.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19549741604902eb99a7ed0ee177a0663ee1eda51a29f71401f166e47e77806a" +dependencies = [ + "include-flate", + "rust-embed-impl", + "rust-embed-utils", + "walkdir", +] + +[[package]] +name = "rust-embed-impl" +version = "8.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb9f96e283ec64401f30d3df8ee2aaeb2561f34c824381efa24a35f79bf40ee4" +dependencies = [ + "proc-macro2", + "quote", + "rust-embed-utils", + "syn 2.0.60", + "walkdir", +] + +[[package]] +name = "rust-embed-utils" +version = "8.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38c74a686185620830701348de757fd36bef4aa9680fd23c49fc539ddcc1af32" +dependencies = [ + "sha2 0.10.8", + "walkdir", +] + [[package]] name = "rustc-demangle" version = "0.1.23" @@ -7428,9 +7608,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.200" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddc6f9cc94d67c0e21aaf7eda3a010fd3af78ebf6e096aa6e2e13c79749cce4f" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] @@ -7457,9 +7637,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.200" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "856f046b9400cee3c8c94ed572ecdb752444c24528c035cd35882aad6f492bcb" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", @@ -7862,7 +8042,7 @@ checksum = "75062c2738b82cd45ae633623caae3393f43eb00aada1dc2d3ebe88db6b0db9b" dependencies = [ "chrono", "libc", - "libflate", + "libflate 2.1.0", "once_cell", "regex", "serde", diff --git a/Cargo.toml b/Cargo.toml index f2cd392c82f..d2898d5c63e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -96,6 +96,7 @@ clap = { version = "4.5.4", features = ["cargo", "wrap_help"] } # Turn off c-kzg's default features which include `blst/portable`. We can turn on blst's portable # feature ourselves when desired. c-kzg = { git = "https://github.com/ethereum/c-kzg-4844", rev = "114fa0382990e9b74b1f90f3b0dc5f97c2f8a7ad" } +eip7594 = { git = "https://github.com/crate-crypto/peerdas-kzg", rev = "8bafeda8d969cf8c8887aab2eaf3ccba37201abf" } compare_fields_derive = { path = "common/compare_fields_derive" } criterion = "0.3" delay_map = "0.3" From 2f0eefa596b971c5e55eec79a8d8ad2e1e9b14a7 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Mon, 17 Jun 2024 19:24:15 +0100 Subject: [PATCH 03/23] chore: integrate peerdaskzg rust library into kzg crate --- crypto/kzg/Cargo.toml | 1 + crypto/kzg/src/lib.rs | 126 +++++++++++++++++++++++------------------- 2 files changed, 71 insertions(+), 56 deletions(-) diff --git a/crypto/kzg/Cargo.toml b/crypto/kzg/Cargo.toml index 2c3c894b49c..388bf41f882 100644 --- a/crypto/kzg/Cargo.toml +++ b/crypto/kzg/Cargo.toml @@ -17,4 +17,5 @@ ethereum_serde_utils = { workspace = true } hex = { workspace = true } ethereum_hashing = { workspace = true } c-kzg = { workspace = true } +eip7594 = { workspace = true } mockall = { workspace = true } diff --git a/crypto/kzg/src/lib.rs b/crypto/kzg/src/lib.rs index 5011d55291e..2da59d7ea22 100644 --- a/crypto/kzg/src/lib.rs +++ b/crypto/kzg/src/lib.rs @@ -13,13 +13,21 @@ pub use c_kzg::{ Blob, Bytes32, Bytes48, KzgSettings, BYTES_PER_BLOB, BYTES_PER_COMMITMENT, BYTES_PER_FIELD_ELEMENT, BYTES_PER_PROOF, FIELD_ELEMENTS_PER_BLOB, }; -pub use c_kzg::{Cell, CELLS_PER_EXT_BLOB}; use mockall::automock; +pub use eip7594::{ + constants::BYTES_PER_CELL, constants::CELLS_PER_EXT_BLOB, verifier::VerifierError, + Bytes48Ref as PeerDASBytes48, Cell, CellID, CellRef, PeerDASContext, +}; + #[derive(Debug)] pub enum Error { /// An error from the underlying kzg library. Kzg(c_kzg::Error), + /// A prover error from the PeerdasKZG library + ProverKZG(eip7594::prover::ProverError), + /// A verifier error from the PeerdasKZG library + VerifierKZG(eip7594::verifier::VerifierError), /// The kzg verification failed KzgVerificationFailed, /// Misc indexing error @@ -36,6 +44,7 @@ impl From for Error { #[derive(Debug)] pub struct Kzg { trusted_setup: KzgSettings, + context: PeerDASContext, } #[automock] @@ -50,6 +59,7 @@ impl Kzg { // Ref: https://notes.ethereum.org/@jtraglia/windowed_multiplications 8, )?, + context: PeerDASContext::default(), }) } @@ -156,17 +166,21 @@ impl Kzg { pub fn compute_cells_and_proofs( &self, blob: &Blob, - ) -> Result< - ( - Box<[Cell; CELLS_PER_EXT_BLOB]>, - Box<[KzgProof; CELLS_PER_EXT_BLOB]>, - ), - Error, - > { - let (cells, proofs) = c_kzg::Cell::compute_cells_and_kzg_proofs(blob, &self.trusted_setup) - .map_err(Into::::into)?; - let proofs = Box::new(proofs.map(|proof| KzgProof::from(proof.to_bytes().into_inner()))); - Ok((cells, proofs)) + ) -> Result<([Cell; CELLS_PER_EXT_BLOB], [KzgProof; CELLS_PER_EXT_BLOB]), Error> { + let blob_bytes: &[u8; BYTES_PER_BLOB] = blob + .as_ref() + .try_into() + .expect("Expected blob to have size {BYTES_PER_BLOB}"); + + let (cells, proofs) = self + .context + .prover_ctx() + .compute_cells_and_kzg_proofs(blob_bytes) + .map_err(Error::ProverKZG)?; + + // Convert the proof type to a c-kzg proof type + let c_kzg_proof = proofs.map(|proof| KzgProof(proof)); + Ok((cells, c_kzg_proof)) } /// Verifies a batch of cell-proof-commitment triplets. @@ -174,70 +188,70 @@ impl Kzg { /// Here, `coordinates` correspond to the (row, col) coordinate of the cell in the extended /// blob "matrix". In the 1D extension, row corresponds to the blob index, and col corresponds /// to the data column index. - pub fn verify_cell_proof_batch( + pub fn verify_cell_proof_batch<'a>( &self, - cells: &[Cell], + cells: &[CellRef<'a>], kzg_proofs: &[Bytes48], coordinates: &[(u64, u64)], kzg_commitments: &[Bytes48], ) -> Result<(), Error> { let (rows, columns): (Vec, Vec) = coordinates.iter().cloned().unzip(); - if !c_kzg::KzgProof::verify_cell_kzg_proof_batch( - kzg_commitments, - &rows, - &columns, - cells, - kzg_proofs, - &self.trusted_setup, - )? { - Err(Error::KzgVerificationFailed) - } else { - Ok(()) - } - } + // The result of this is either an Ok indicating the proof passed, or an Err indicating + // the proof failed or something else went wrong. + + let proofs: Vec = kzg_proofs + .iter() + .map(|proof| proof.as_ref().try_into().unwrap()) + .collect(); + let commitments: Vec = kzg_commitments + .iter() + .map(|commitment| commitment.as_ref().try_into().unwrap()) + .collect(); + let verification_result = self.context.verifier_ctx().verify_cell_kzg_proof_batch( + commitments.to_vec(), + rows, + columns, + cells.to_vec(), + proofs.to_vec(), + ); - fn cells_to_blob(&self, cells: &[Cell; c_kzg::CELLS_PER_EXT_BLOB]) -> Result { - Ok(Blob::cells_to_blob(cells)?) + // Modify the result so it matches roughly what the previous method was doing. + match verification_result { + Ok(_) => Ok(()), + Err(VerifierError::InvalidProof) => Err(Error::KzgVerificationFailed), + Err(e) => Err(Error::VerifierKZG(e)), + } } - pub fn recover_cells_and_compute_kzg_proofs( + pub fn recover_cells_and_compute_kzg_proofs<'a>( &self, cell_ids: &[u64], - cells: &[Cell], - ) -> Result< - ( - Box<[Cell; CELLS_PER_EXT_BLOB]>, - Box<[KzgProof; CELLS_PER_EXT_BLOB]>, - ), - Error, - > { - let all_cells = c_kzg::Cell::recover_all_cells(cell_ids, cells, &self.trusted_setup)?; - let blob = self.cells_to_blob(&all_cells)?; - self.compute_cells_and_proofs(&blob) + cells: &[CellRef<'a>], + ) -> Result<([Cell; CELLS_PER_EXT_BLOB], [KzgProof; CELLS_PER_EXT_BLOB]), Error> { + let (cells, proofs) = self + .context + .prover_ctx() + .recover_cells_and_proofs(cell_ids.to_vec(), cells.to_vec(), vec![]) + .map_err(Error::ProverKZG)?; + + // Convert the proof type to a c-kzg proof type + let c_kzg_proof = proofs.map(|proof| KzgProof(proof)); + Ok((cells, c_kzg_proof)) } } pub mod mock { + use crate::{Blob, Cell, BYTES_PER_CELL, CELLS_PER_EXT_BLOB}; use crate::{Error, KzgProof}; - use c_kzg::{Blob, Cell, CELLS_PER_EXT_BLOB}; - - pub const MOCK_KZG_BYTES_PER_CELL: usize = 2048; #[allow(clippy::type_complexity)] pub fn compute_cells_and_proofs( _blob: &Blob, - ) -> Result< - ( - Box<[Cell; CELLS_PER_EXT_BLOB]>, - Box<[KzgProof; CELLS_PER_EXT_BLOB]>, - ), - Error, - > { - let empty_cell = Cell::new([0; MOCK_KZG_BYTES_PER_CELL]); - Ok(( - Box::new([empty_cell; CELLS_PER_EXT_BLOB]), - Box::new([KzgProof::empty(); CELLS_PER_EXT_BLOB]), - )) + ) -> Result<([Cell; CELLS_PER_EXT_BLOB], [KzgProof; CELLS_PER_EXT_BLOB]), Error> { + let empty_cells = vec![Cell::new([0; BYTES_PER_CELL]); CELLS_PER_EXT_BLOB] + .try_into() + .expect("expected {CELLS_PER_EXT_BLOB} number of items"); + Ok((empty_cells, [KzgProof::empty(); CELLS_PER_EXT_BLOB])) } } From 2bec02cadf57371baa6ff55889a6a4a360d0737a Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Mon, 17 Jun 2024 19:30:42 +0100 Subject: [PATCH 04/23] chore(multi): - update `ssz_cell_to_crypto_cell` - update conversion from the crypto cell type to a Vec. Since the Rust library defines them as references to an array, the conversion is simply `to_vec` --- beacon_node/beacon_chain/src/kzg_utils.rs | 9 ++++++--- consensus/types/src/data_column_sidecar.rs | 23 +++++++++------------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/beacon_node/beacon_chain/src/kzg_utils.rs b/beacon_node/beacon_chain/src/kzg_utils.rs index de788234a81..8015fd6ffa6 100644 --- a/beacon_node/beacon_chain/src/kzg_utils.rs +++ b/beacon_node/beacon_chain/src/kzg_utils.rs @@ -1,4 +1,4 @@ -use kzg::{Blob as KzgBlob, Bytes48, Cell as KzgCell, Error as KzgError, Kzg}; +use kzg::{Blob as KzgBlob, Bytes48, CellRef as KzgCellRef, Error as KzgError, Kzg}; use std::sync::Arc; use types::data_column_sidecar::Cell; use types::{Blob, DataColumnSidecar, EthSpec, Hash256, KzgCommitment, KzgProof}; @@ -11,8 +11,11 @@ fn ssz_blob_to_crypto_blob(blob: &Blob) -> Result(cell: &Cell) -> Result { - KzgCell::from_bytes(cell.as_ref()).map_err(Into::into) +fn ssz_cell_to_crypto_cell(cell: &Cell) -> Result { + let cell_bytes: &[u8] = cell.as_ref(); + Ok(cell_bytes + .try_into() + .expect("expected cell to have size {BYTES_PER_CELL}. This should be guaranteed by the `FixedVector type")) } /// Validate a single blob-commitment-proof triplet from a `BlobSidecar`. diff --git a/consensus/types/src/data_column_sidecar.rs b/consensus/types/src/data_column_sidecar.rs index 9c97ac9c6ef..4c665b6828d 100644 --- a/consensus/types/src/data_column_sidecar.rs +++ b/consensus/types/src/data_column_sidecar.rs @@ -9,7 +9,7 @@ use bls::Signature; use derivative::Derivative; #[cfg_attr(test, double)] use kzg::Kzg; -use kzg::{Blob as KzgBlob, Cell as KzgCell, Error as KzgError}; +use kzg::{Blob as KzgBlob, CellRef as KzgCellRef, Error as KzgError}; use kzg::{KzgCommitment, KzgProof}; use merkle_proof::verify_merkle_proof; #[cfg(test)] @@ -144,11 +144,7 @@ impl DataColumnSidecar { .ok_or(DataColumnSidecarError::InconsistentArrayLength(format!( "Missing blob cell at index {col}" )))?; - let cell: Vec = cell - .into_inner() - .into_iter() - .flat_map(|data| (*data).into_iter()) - .collect(); + let cell: Vec = cell.to_vec(); let cell = Cell::::from(cell); let proof = blob_cell_proofs.get(col).ok_or( @@ -214,7 +210,7 @@ impl DataColumnSidecar { let blob_cells_and_proofs_vec = (0..num_of_blobs) .into_par_iter() .map(|row_index| { - let mut cells: Vec = vec![]; + let mut cells: Vec = vec![]; let mut cell_ids: Vec = vec![]; for data_column in data_columns { let cell = data_column.column.get(row_index).ok_or( @@ -240,11 +236,7 @@ impl DataColumnSidecar { .ok_or(KzgError::InconsistentArrayLength(format!( "Missing blob cell at index {col}" )))?; - let cell: Vec = cell - .into_inner() - .into_iter() - .flat_map(|data| (*data).into_iter()) - .collect(); + let cell: Vec = cell.to_vec(); let cell = Cell::::from(cell); let proof = blob_cell_proofs @@ -393,8 +385,11 @@ impl From for DataColumnSidecarError { /// Converts a cell ssz List object to an array to be used with the kzg /// crypto library. -fn ssz_cell_to_crypto_cell(cell: &Cell) -> Result { - KzgCell::from_bytes(cell.as_ref()).map_err(Into::into) +fn ssz_cell_to_crypto_cell(cell: &Cell) -> Result { + let cell_bytes: &[u8] = cell.as_ref(); + Ok(cell_bytes + .try_into() + .expect("expected cell to have size {BYTES_PER_CELL}. This should be guaranteed by the `FixedVector type")) } #[cfg(test)] From 6f3c1b6563374d5672017245b63a571e7620fcef Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Mon, 17 Jun 2024 19:32:34 +0100 Subject: [PATCH 05/23] chore(multi): - update rest of code to handle the new crypto `Cell` type - update test case code to no longer use the Box type --- .../src/cases/kzg_compute_cells_and_kzg_proofs.rs | 11 ++++------- .../ef_tests/src/cases/kzg_verify_blob_kzg_proof.rs | 5 +++-- .../src/cases/kzg_verify_cell_kzg_proof_batch.rs | 8 ++------ 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/testing/ef_tests/src/cases/kzg_compute_cells_and_kzg_proofs.rs b/testing/ef_tests/src/cases/kzg_compute_cells_and_kzg_proofs.rs index 63d528467bd..acc9d85d4b8 100644 --- a/testing/ef_tests/src/cases/kzg_compute_cells_and_kzg_proofs.rs +++ b/testing/ef_tests/src/cases/kzg_compute_cells_and_kzg_proofs.rs @@ -62,12 +62,9 @@ impl Case for KZGComputeCellsAndKZGProofs { .ok() }); - compare_result::< - ( - Box<[Cell; CELLS_PER_EXT_BLOB]>, - Box<[KzgProof; CELLS_PER_EXT_BLOB]>, - ), - _, - >(&cells_and_proofs, &expected) + compare_result::<([Cell; CELLS_PER_EXT_BLOB], [KzgProof; CELLS_PER_EXT_BLOB]), _>( + &cells_and_proofs, + &expected, + ) } } diff --git a/testing/ef_tests/src/cases/kzg_verify_blob_kzg_proof.rs b/testing/ef_tests/src/cases/kzg_verify_blob_kzg_proof.rs index dca9af96161..d89d3a28790 100644 --- a/testing/ef_tests/src/cases/kzg_verify_blob_kzg_proof.rs +++ b/testing/ef_tests/src/cases/kzg_verify_blob_kzg_proof.rs @@ -40,8 +40,9 @@ pub fn parse_cell(cell: &str) -> Result { hex::decode(strip_0x(cell)?) .map_err(|e| Error::FailedToParseTest(format!("Failed to parse cell: {:?}", e))) .and_then(|bytes| { - Cell::from_bytes(bytes.as_ref()) - .map_err(|e| Error::FailedToParseTest(format!("Failed to parse proof: {:?}", e))) + bytes + .try_into() + .map_err(|e| Error::FailedToParseTest(format!("Failed to parse cell: {:?}", e))) }) } diff --git a/testing/ef_tests/src/cases/kzg_verify_cell_kzg_proof_batch.rs b/testing/ef_tests/src/cases/kzg_verify_cell_kzg_proof_batch.rs index 150cc47770f..f2f9a33067d 100644 --- a/testing/ef_tests/src/cases/kzg_verify_cell_kzg_proof_batch.rs +++ b/testing/ef_tests/src/cases/kzg_verify_cell_kzg_proof_batch.rs @@ -56,12 +56,8 @@ impl Case for KZGVerifyCellKZGProofBatch { parse_input(&self.input).and_then(|(cells, proofs, coordinates, commitments)| { let proofs: Vec = proofs.iter().map(|&proof| proof.into()).collect(); let commitments: Vec = commitments.iter().map(|&c| c.into()).collect(); - match KZG.verify_cell_proof_batch( - cells.as_slice(), - &proofs, - &coordinates, - &commitments, - ) { + let cells = cells.iter().map(|c| c.as_ref()).collect::>(); + match KZG.verify_cell_proof_batch(&cells, &proofs, &coordinates, &commitments) { Ok(_) => Ok(true), Err(KzgError::KzgVerificationFailed) => Ok(false), Err(e) => Err(Error::InternalError(format!( From d09a4955d35538bbabaa2165f527687f4ae0131c Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Mon, 17 Jun 2024 19:38:11 +0100 Subject: [PATCH 06/23] chore: cleanup of superfluous conversions --- crypto/kzg/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crypto/kzg/src/lib.rs b/crypto/kzg/src/lib.rs index 2da59d7ea22..e09ec8001e2 100644 --- a/crypto/kzg/src/lib.rs +++ b/crypto/kzg/src/lib.rs @@ -179,7 +179,7 @@ impl Kzg { .map_err(Error::ProverKZG)?; // Convert the proof type to a c-kzg proof type - let c_kzg_proof = proofs.map(|proof| KzgProof(proof)); + let c_kzg_proof = proofs.map(KzgProof); Ok((cells, c_kzg_proof)) } @@ -201,11 +201,11 @@ impl Kzg { let proofs: Vec = kzg_proofs .iter() - .map(|proof| proof.as_ref().try_into().unwrap()) + .map(|proof| proof.as_ref()) .collect(); let commitments: Vec = kzg_commitments .iter() - .map(|commitment| commitment.as_ref().try_into().unwrap()) + .map(|commitment| commitment.as_ref()) .collect(); let verification_result = self.context.verifier_ctx().verify_cell_kzg_proof_batch( commitments.to_vec(), @@ -235,7 +235,7 @@ impl Kzg { .map_err(Error::ProverKZG)?; // Convert the proof type to a c-kzg proof type - let c_kzg_proof = proofs.map(|proof| KzgProof(proof)); + let c_kzg_proof = proofs.map(KzgProof); Ok((cells, c_kzg_proof)) } } From d15a8ae42913a65acfd0cb97b0809417e6cd8dc4 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Mon, 17 Jun 2024 20:22:04 +0100 Subject: [PATCH 07/23] chore: revert c-kzg dependency back to v1 --- Cargo.lock | 4 ++-- Cargo.toml | 5 +---- crypto/kzg/src/lib.rs | 3 --- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fe16be5cf1b..7a35fbab773 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1168,14 +1168,14 @@ dependencies = [ [[package]] name = "c-kzg" version = "1.0.2" -source = "git+https://github.com/ethereum/c-kzg-4844?rev=114fa0382990e9b74b1f90f3b0dc5f97c2f8a7ad#114fa0382990e9b74b1f90f3b0dc5f97c2f8a7ad" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdf100c4cea8f207e883ff91ca886d621d8a166cb04971dfaa9bb8fd99ed95df" dependencies = [ "blst", "cc", "glob", "hex", "libc", - "serde", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index d2898d5c63e..2c05d823f8e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -92,10 +92,7 @@ bytes = "1" clap = { version = "4.5.4", features = ["cargo", "wrap_help"] } # Turn off c-kzg's default features which include `blst/portable`. We can turn on blst's portable # feature ourselves when desired. -# TODO(das): switch to c-kzg crate before merging back to unstable (and disable default-features) if possible -# Turn off c-kzg's default features which include `blst/portable`. We can turn on blst's portable -# feature ourselves when desired. -c-kzg = { git = "https://github.com/ethereum/c-kzg-4844", rev = "114fa0382990e9b74b1f90f3b0dc5f97c2f8a7ad" } +c-kzg = { version = "1", default-features = false } eip7594 = { git = "https://github.com/crate-crypto/peerdas-kzg", rev = "8bafeda8d969cf8c8887aab2eaf3ccba37201abf" } compare_fields_derive = { path = "common/compare_fields_derive" } criterion = "0.3" diff --git a/crypto/kzg/src/lib.rs b/crypto/kzg/src/lib.rs index e09ec8001e2..509be917739 100644 --- a/crypto/kzg/src/lib.rs +++ b/crypto/kzg/src/lib.rs @@ -55,9 +55,6 @@ impl Kzg { trusted_setup: KzgSettings::load_trusted_setup( &trusted_setup.g1_points(), &trusted_setup.g2_points(), - // Enable precomputed table for 8 bits, with 96MB of memory overhead per process - // Ref: https://notes.ethereum.org/@jtraglia/windowed_multiplications - 8, )?, context: PeerDASContext::default(), }) From ed418a622751ee64f783ac6e85cee3972a71a293 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Mon, 17 Jun 2024 20:23:26 +0100 Subject: [PATCH 08/23] chore: move dependency into correct order --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 2c05d823f8e..af0091eddb6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -93,13 +93,13 @@ clap = { version = "4.5.4", features = ["cargo", "wrap_help"] } # Turn off c-kzg's default features which include `blst/portable`. We can turn on blst's portable # feature ourselves when desired. c-kzg = { version = "1", default-features = false } -eip7594 = { git = "https://github.com/crate-crypto/peerdas-kzg", rev = "8bafeda8d969cf8c8887aab2eaf3ccba37201abf" } compare_fields_derive = { path = "common/compare_fields_derive" } criterion = "0.3" delay_map = "0.3" derivative = "2" dirs = "3" either = "1.9" +eip7594 = { git = "https://github.com/crate-crypto/peerdas-kzg", rev = "8bafeda8d969cf8c8887aab2eaf3ccba37201abf" } discv5 = { version = "0.4.1", features = ["libp2p"] } env_logger = "0.9" error-chain = "0.12" From 37552cbf588585f0b19528322bdf2d04620e16a8 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Mon, 17 Jun 2024 20:40:06 +0100 Subject: [PATCH 09/23] chore: update rust dependency - This version includes a new method `PeerDasContext::with_num_threads` --- Cargo.lock | 10 +++++----- Cargo.toml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7a35fbab773..142e1a23465 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1534,7 +1534,7 @@ dependencies = [ [[package]] name = "crate_crypto_internal_peerdas_bls12_381" version = "0.3.0" -source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=8bafeda8d969cf8c8887aab2eaf3ccba37201abf#8bafeda8d969cf8c8887aab2eaf3ccba37201abf" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=5a44c5995ade5de0ac06909bcbacab8437847ba4#5a44c5995ade5de0ac06909bcbacab8437847ba4" dependencies = [ "blst", "blstrs", @@ -1547,7 +1547,7 @@ dependencies = [ [[package]] name = "crate_crypto_internal_peerdas_erasure_codes" version = "0.3.0" -source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=8bafeda8d969cf8c8887aab2eaf3ccba37201abf#8bafeda8d969cf8c8887aab2eaf3ccba37201abf" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=5a44c5995ade5de0ac06909bcbacab8437847ba4#5a44c5995ade5de0ac06909bcbacab8437847ba4" dependencies = [ "crate_crypto_internal_peerdas_bls12_381", "crate_crypto_internal_peerdas_polynomial", @@ -1556,7 +1556,7 @@ dependencies = [ [[package]] name = "crate_crypto_internal_peerdas_polynomial" version = "0.3.0" -source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=8bafeda8d969cf8c8887aab2eaf3ccba37201abf#8bafeda8d969cf8c8887aab2eaf3ccba37201abf" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=5a44c5995ade5de0ac06909bcbacab8437847ba4#5a44c5995ade5de0ac06909bcbacab8437847ba4" dependencies = [ "crate_crypto_internal_peerdas_bls12_381", ] @@ -1564,7 +1564,7 @@ dependencies = [ [[package]] name = "crate_crypto_kzg_multi_open_fk20" version = "0.3.0" -source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=8bafeda8d969cf8c8887aab2eaf3ccba37201abf#8bafeda8d969cf8c8887aab2eaf3ccba37201abf" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=5a44c5995ade5de0ac06909bcbacab8437847ba4#5a44c5995ade5de0ac06909bcbacab8437847ba4" dependencies = [ "crate_crypto_internal_peerdas_bls12_381", "crate_crypto_internal_peerdas_polynomial", @@ -2274,7 +2274,7 @@ dependencies = [ [[package]] name = "eip7594" version = "0.3.0" -source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=8bafeda8d969cf8c8887aab2eaf3ccba37201abf#8bafeda8d969cf8c8887aab2eaf3ccba37201abf" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=5a44c5995ade5de0ac06909bcbacab8437847ba4#5a44c5995ade5de0ac06909bcbacab8437847ba4" dependencies = [ "crate_crypto_internal_peerdas_bls12_381", "crate_crypto_internal_peerdas_erasure_codes", diff --git a/Cargo.toml b/Cargo.toml index af0091eddb6..e5973009935 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -99,7 +99,7 @@ delay_map = "0.3" derivative = "2" dirs = "3" either = "1.9" -eip7594 = { git = "https://github.com/crate-crypto/peerdas-kzg", rev = "8bafeda8d969cf8c8887aab2eaf3ccba37201abf" } +eip7594 = { git = "https://github.com/crate-crypto/peerdas-kzg", rev = "5a44c5995ade5de0ac06909bcbacab8437847ba4" } discv5 = { version = "0.4.1", features = ["libp2p"] } env_logger = "0.9" error-chain = "0.12" From 5f142aa7a845765cdece678a2a45cfa645fe8cf6 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Mon, 17 Jun 2024 20:40:45 +0100 Subject: [PATCH 10/23] chore: remove Default initialization of PeerDasContext and explicitly set the parameters in `new_from_trusted_setup` --- crypto/kzg/src/lib.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/crypto/kzg/src/lib.rs b/crypto/kzg/src/lib.rs index 509be917739..bf2633f9c27 100644 --- a/crypto/kzg/src/lib.rs +++ b/crypto/kzg/src/lib.rs @@ -17,7 +17,7 @@ use mockall::automock; pub use eip7594::{ constants::BYTES_PER_CELL, constants::CELLS_PER_EXT_BLOB, verifier::VerifierError, - Bytes48Ref as PeerDASBytes48, Cell, CellID, CellRef, PeerDASContext, + Bytes48Ref as PeerDASBytes48, Cell, CellID, CellRef, PeerDASContext, TrustedSetup as PeerDASTrustedSetup, }; #[derive(Debug)] @@ -51,12 +51,25 @@ pub struct Kzg { impl Kzg { /// Load the kzg trusted setup parameters from a vec of G1 and G2 points. pub fn new_from_trusted_setup(trusted_setup: TrustedSetup) -> Result { + + // Initialize the trusted setup using default parameters + // + // Note: One can also use `from_json` to initialize it from the consensus-specs + // json string. + let peerdas_trusted_setup = PeerDASTrustedSetup::default(); + // Set the number of threads to be used + // + // we set it to 1 to match the c-kzg performance + const NUM_THREADS : usize = 1; + + let context = PeerDASContext::with_threads(&peerdas_trusted_setup, NUM_THREADS); + Ok(Self { trusted_setup: KzgSettings::load_trusted_setup( &trusted_setup.g1_points(), &trusted_setup.g2_points(), )?, - context: PeerDASContext::default(), + context, }) } From 405e80e3ab9515a9b21d14e090d18ed4b61bc798 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Mon, 17 Jun 2024 21:02:43 +0100 Subject: [PATCH 11/23] chore: cleanup exports --- crypto/kzg/src/lib.rs | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/crypto/kzg/src/lib.rs b/crypto/kzg/src/lib.rs index bf2633f9c27..d263db331d2 100644 --- a/crypto/kzg/src/lib.rs +++ b/crypto/kzg/src/lib.rs @@ -16,18 +16,19 @@ pub use c_kzg::{ use mockall::automock; pub use eip7594::{ - constants::BYTES_PER_CELL, constants::CELLS_PER_EXT_BLOB, verifier::VerifierError, - Bytes48Ref as PeerDASBytes48, Cell, CellID, CellRef, PeerDASContext, TrustedSetup as PeerDASTrustedSetup, + constants::{BYTES_PER_CELL, CELLS_PER_EXT_BLOB}, + Cell, CellID, CellRef, TrustedSetup as PeerDASTrustedSetup, }; +use eip7594::{prover::ProverError, verifier::VerifierError, PeerDASContext}; #[derive(Debug)] pub enum Error { /// An error from the underlying kzg library. Kzg(c_kzg::Error), /// A prover error from the PeerdasKZG library - ProverKZG(eip7594::prover::ProverError), + ProverKZG(ProverError), /// A verifier error from the PeerdasKZG library - VerifierKZG(eip7594::verifier::VerifierError), + VerifierKZG(VerifierError), /// The kzg verification failed KzgVerificationFailed, /// Misc indexing error @@ -51,16 +52,15 @@ pub struct Kzg { impl Kzg { /// Load the kzg trusted setup parameters from a vec of G1 and G2 points. pub fn new_from_trusted_setup(trusted_setup: TrustedSetup) -> Result { - // Initialize the trusted setup using default parameters - // + // // Note: One can also use `from_json` to initialize it from the consensus-specs // json string. let peerdas_trusted_setup = PeerDASTrustedSetup::default(); // Set the number of threads to be used // // we set it to 1 to match the c-kzg performance - const NUM_THREADS : usize = 1; + const NUM_THREADS: usize = 1; let context = PeerDASContext::with_threads(&peerdas_trusted_setup, NUM_THREADS); @@ -209,11 +209,8 @@ impl Kzg { // The result of this is either an Ok indicating the proof passed, or an Err indicating // the proof failed or something else went wrong. - let proofs: Vec = kzg_proofs - .iter() - .map(|proof| proof.as_ref()) - .collect(); - let commitments: Vec = kzg_commitments + let proofs: Vec<_> = kzg_proofs.iter().map(|proof| proof.as_ref()).collect(); + let commitments: Vec<_> = kzg_commitments .iter() .map(|commitment| commitment.as_ref()) .collect(); From fc34d598e7644b7c344793c2d87603d1584ba041 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Wed, 19 Jun 2024 09:23:34 +0100 Subject: [PATCH 12/23] chore: commit updated cargo.lock --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 64f265bfa28..2a64d6d75bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7220,7 +7220,7 @@ dependencies = [ "proc-macro2", "quote", "rust-embed-utils", - "syn 2.0.60", + "syn 2.0.66", "walkdir", ] From fda359e3c2079012a255a0f302da167f994668e2 Mon Sep 17 00:00:00 2001 From: kevaundray Date: Mon, 24 Jun 2024 17:19:11 +0100 Subject: [PATCH 13/23] Update Cargo.toml Co-authored-by: Jimmy Chen --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index a9c2e5b6d3e..01d49fe6d07 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -99,7 +99,7 @@ delay_map = "0.3" derivative = "2" dirs = "3" either = "1.9" -eip7594 = { git = "https://github.com/crate-crypto/peerdas-kzg", rev = "5a44c5995ade5de0ac06909bcbacab8437847ba4" } +peerdas-kzg = { git = "https://github.com/crate-crypto/peerdas-kzg", rev = "5a44c5995ade5de0ac06909bcbacab8437847ba4", package = "eip7594" } discv5 = { version = "0.4.1", features = ["libp2p"] } env_logger = "0.9" error-chain = "0.12" From 1a57456c0001b251b2669602973de4758737ece9 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Wed, 26 Jun 2024 10:24:36 +0100 Subject: [PATCH 14/23] chore: rename dependency --- crypto/kzg/Cargo.toml | 2 +- crypto/kzg/src/lib.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crypto/kzg/Cargo.toml b/crypto/kzg/Cargo.toml index 388bf41f882..1f378c7dc9f 100644 --- a/crypto/kzg/Cargo.toml +++ b/crypto/kzg/Cargo.toml @@ -17,5 +17,5 @@ ethereum_serde_utils = { workspace = true } hex = { workspace = true } ethereum_hashing = { workspace = true } c-kzg = { workspace = true } -eip7594 = { workspace = true } +peerdas-kzg = { workspace = true } mockall = { workspace = true } diff --git a/crypto/kzg/src/lib.rs b/crypto/kzg/src/lib.rs index 2dd96443c88..f562eae6620 100644 --- a/crypto/kzg/src/lib.rs +++ b/crypto/kzg/src/lib.rs @@ -15,11 +15,11 @@ pub use c_kzg::{ }; use mockall::automock; -pub use eip7594::{ +pub use peerdas_kzg::{ constants::{BYTES_PER_CELL, CELLS_PER_EXT_BLOB}, Cell, CellID, CellRef, TrustedSetup as PeerDASTrustedSetup, }; -use eip7594::{prover::ProverError, verifier::VerifierError, PeerDASContext}; +use peerdas_kzg::{prover::ProverError, verifier::VerifierError, PeerDASContext}; pub type CellsAndKzgProofs = ([Cell; CELLS_PER_EXT_BLOB], [KzgProof; CELLS_PER_EXT_BLOB]); #[derive(Debug)] From 42316daf1c93bc208b606e41d1f6c1a67369128b Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Wed, 26 Jun 2024 10:39:56 +0100 Subject: [PATCH 15/23] chore: update peerdas lib - sets the blst version to 0.3 so that it matches whatever lighthouse is using. Although 0.3.12 is latest, lighthouse is pinned to 0.3.3 --- Cargo.lock | 10 +++++----- Cargo.toml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2a64d6d75bb..8116e772fbd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1557,7 +1557,7 @@ dependencies = [ [[package]] name = "crate_crypto_internal_peerdas_bls12_381" version = "0.3.0" -source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=5a44c5995ade5de0ac06909bcbacab8437847ba4#5a44c5995ade5de0ac06909bcbacab8437847ba4" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=3c0c0706bb8c6c6c6f78560850c7899a15eee030#3c0c0706bb8c6c6c6f78560850c7899a15eee030" dependencies = [ "blst", "blstrs", @@ -1570,7 +1570,7 @@ dependencies = [ [[package]] name = "crate_crypto_internal_peerdas_erasure_codes" version = "0.3.0" -source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=5a44c5995ade5de0ac06909bcbacab8437847ba4#5a44c5995ade5de0ac06909bcbacab8437847ba4" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=3c0c0706bb8c6c6c6f78560850c7899a15eee030#3c0c0706bb8c6c6c6f78560850c7899a15eee030" dependencies = [ "crate_crypto_internal_peerdas_bls12_381", "crate_crypto_internal_peerdas_polynomial", @@ -1579,7 +1579,7 @@ dependencies = [ [[package]] name = "crate_crypto_internal_peerdas_polynomial" version = "0.3.0" -source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=5a44c5995ade5de0ac06909bcbacab8437847ba4#5a44c5995ade5de0ac06909bcbacab8437847ba4" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=3c0c0706bb8c6c6c6f78560850c7899a15eee030#3c0c0706bb8c6c6c6f78560850c7899a15eee030" dependencies = [ "crate_crypto_internal_peerdas_bls12_381", ] @@ -1587,7 +1587,7 @@ dependencies = [ [[package]] name = "crate_crypto_kzg_multi_open_fk20" version = "0.3.0" -source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=5a44c5995ade5de0ac06909bcbacab8437847ba4#5a44c5995ade5de0ac06909bcbacab8437847ba4" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=3c0c0706bb8c6c6c6f78560850c7899a15eee030#3c0c0706bb8c6c6c6f78560850c7899a15eee030" dependencies = [ "crate_crypto_internal_peerdas_bls12_381", "crate_crypto_internal_peerdas_polynomial", @@ -2275,7 +2275,7 @@ dependencies = [ [[package]] name = "eip7594" version = "0.3.0" -source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=5a44c5995ade5de0ac06909bcbacab8437847ba4#5a44c5995ade5de0ac06909bcbacab8437847ba4" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=3c0c0706bb8c6c6c6f78560850c7899a15eee030#3c0c0706bb8c6c6c6f78560850c7899a15eee030" dependencies = [ "crate_crypto_internal_peerdas_bls12_381", "crate_crypto_internal_peerdas_erasure_codes", diff --git a/Cargo.toml b/Cargo.toml index 01d49fe6d07..69384b8bf72 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -99,7 +99,7 @@ delay_map = "0.3" derivative = "2" dirs = "3" either = "1.9" -peerdas-kzg = { git = "https://github.com/crate-crypto/peerdas-kzg", rev = "5a44c5995ade5de0ac06909bcbacab8437847ba4", package = "eip7594" } +peerdas-kzg = { git = "https://github.com/crate-crypto/peerdas-kzg", rev = "3c0c0706bb8c6c6c6f78560850c7899a15eee030", package = "eip7594" } discv5 = { version = "0.4.1", features = ["libp2p"] } env_logger = "0.9" error-chain = "0.12" From ddcd60d39067fd71173db2ca79c372ec6ce91a43 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Wed, 26 Jun 2024 10:43:47 +0100 Subject: [PATCH 16/23] chore: fix clippy lifetime - Rust doesn't allow you to elide the lifetime on type aliases --- crypto/kzg/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crypto/kzg/src/lib.rs b/crypto/kzg/src/lib.rs index f562eae6620..acafb17262c 100644 --- a/crypto/kzg/src/lib.rs +++ b/crypto/kzg/src/lib.rs @@ -195,6 +195,7 @@ impl Kzg { /// Here, `coordinates` correspond to the (row, col) coordinate of the cell in the extended /// blob "matrix". In the 1D extension, row corresponds to the blob index, and col corresponds /// to the data column index. + #[allow(clippy::needless_lifetimes)] pub fn verify_cell_proof_batch<'a>( &self, cells: &[CellRef<'a>], @@ -227,6 +228,7 @@ impl Kzg { } } + #[allow(clippy::needless_lifetimes)] pub fn recover_cells_and_compute_kzg_proofs<'a>( &self, cell_ids: &[u64], From 25e7b72feae7b006a09e8021feb7ab164433aeab Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Wed, 26 Jun 2024 10:52:28 +0100 Subject: [PATCH 17/23] chore: cargo clippy fix --- testing/ef_tests/src/cases/kzg_recover_cells_and_kzg_proofs.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testing/ef_tests/src/cases/kzg_recover_cells_and_kzg_proofs.rs b/testing/ef_tests/src/cases/kzg_recover_cells_and_kzg_proofs.rs index c177094d0b1..2aaddc3ae11 100644 --- a/testing/ef_tests/src/cases/kzg_recover_cells_and_kzg_proofs.rs +++ b/testing/ef_tests/src/cases/kzg_recover_cells_and_kzg_proofs.rs @@ -58,10 +58,11 @@ impl Case for KZGRecoverCellsAndKZGProofs { let result = parse_input(&self.input).and_then(|(input_proofs, input_cells, cell_indices)| { + let input_cells_ref : Vec<_>= input_cells.iter().map(|cell| &**cell).collect(); let (cells, proofs) = KZG .recover_cells_and_compute_kzg_proofs( cell_indices.as_slice(), - input_cells.as_slice(), + input_cells_ref.as_slice(), ) .map_err(|e| { Error::InternalError(format!( From dda51333a81bc36854b3cc3bad08508a8ce58b16 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Wed, 26 Jun 2024 12:03:21 +0100 Subject: [PATCH 18/23] chore: cargo fmt --- testing/ef_tests/src/cases/kzg_recover_cells_and_kzg_proofs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/ef_tests/src/cases/kzg_recover_cells_and_kzg_proofs.rs b/testing/ef_tests/src/cases/kzg_recover_cells_and_kzg_proofs.rs index 2aaddc3ae11..e759ccf4b00 100644 --- a/testing/ef_tests/src/cases/kzg_recover_cells_and_kzg_proofs.rs +++ b/testing/ef_tests/src/cases/kzg_recover_cells_and_kzg_proofs.rs @@ -58,7 +58,7 @@ impl Case for KZGRecoverCellsAndKZGProofs { let result = parse_input(&self.input).and_then(|(input_proofs, input_cells, cell_indices)| { - let input_cells_ref : Vec<_>= input_cells.iter().map(|cell| &**cell).collect(); + let input_cells_ref: Vec<_> = input_cells.iter().map(|cell| &**cell).collect(); let (cells, proofs) = KZG .recover_cells_and_compute_kzg_proofs( cell_indices.as_slice(), From 126ac96bb3f730bd36b0fa3b480c986c079b4606 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Wed, 26 Jun 2024 12:52:17 +0100 Subject: [PATCH 19/23] chore: update lib to add redundant checks (these will be removed in consensus-specs PR 3819) --- Cargo.lock | 10 +++++----- Cargo.toml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8116e772fbd..2de4fb5fa5d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1557,7 +1557,7 @@ dependencies = [ [[package]] name = "crate_crypto_internal_peerdas_bls12_381" version = "0.3.0" -source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=3c0c0706bb8c6c6c6f78560850c7899a15eee030#3c0c0706bb8c6c6c6f78560850c7899a15eee030" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=925e90b6806f97b991f784890210a4ad68437208#925e90b6806f97b991f784890210a4ad68437208" dependencies = [ "blst", "blstrs", @@ -1570,7 +1570,7 @@ dependencies = [ [[package]] name = "crate_crypto_internal_peerdas_erasure_codes" version = "0.3.0" -source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=3c0c0706bb8c6c6c6f78560850c7899a15eee030#3c0c0706bb8c6c6c6f78560850c7899a15eee030" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=925e90b6806f97b991f784890210a4ad68437208#925e90b6806f97b991f784890210a4ad68437208" dependencies = [ "crate_crypto_internal_peerdas_bls12_381", "crate_crypto_internal_peerdas_polynomial", @@ -1579,7 +1579,7 @@ dependencies = [ [[package]] name = "crate_crypto_internal_peerdas_polynomial" version = "0.3.0" -source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=3c0c0706bb8c6c6c6f78560850c7899a15eee030#3c0c0706bb8c6c6c6f78560850c7899a15eee030" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=925e90b6806f97b991f784890210a4ad68437208#925e90b6806f97b991f784890210a4ad68437208" dependencies = [ "crate_crypto_internal_peerdas_bls12_381", ] @@ -1587,7 +1587,7 @@ dependencies = [ [[package]] name = "crate_crypto_kzg_multi_open_fk20" version = "0.3.0" -source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=3c0c0706bb8c6c6c6f78560850c7899a15eee030#3c0c0706bb8c6c6c6f78560850c7899a15eee030" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=925e90b6806f97b991f784890210a4ad68437208#925e90b6806f97b991f784890210a4ad68437208" dependencies = [ "crate_crypto_internal_peerdas_bls12_381", "crate_crypto_internal_peerdas_polynomial", @@ -2275,7 +2275,7 @@ dependencies = [ [[package]] name = "eip7594" version = "0.3.0" -source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=3c0c0706bb8c6c6c6f78560850c7899a15eee030#3c0c0706bb8c6c6c6f78560850c7899a15eee030" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=925e90b6806f97b991f784890210a4ad68437208#925e90b6806f97b991f784890210a4ad68437208" dependencies = [ "crate_crypto_internal_peerdas_bls12_381", "crate_crypto_internal_peerdas_erasure_codes", diff --git a/Cargo.toml b/Cargo.toml index 69384b8bf72..dac1306afb9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -99,7 +99,7 @@ delay_map = "0.3" derivative = "2" dirs = "3" either = "1.9" -peerdas-kzg = { git = "https://github.com/crate-crypto/peerdas-kzg", rev = "3c0c0706bb8c6c6c6f78560850c7899a15eee030", package = "eip7594" } +peerdas-kzg = { git = "https://github.com/crate-crypto/peerdas-kzg", rev = "925e90b6806f97b991f784890210a4ad68437208", package = "eip7594" } discv5 = { version = "0.4.1", features = ["libp2p"] } env_logger = "0.9" error-chain = "0.12" From 05426eeccdb24425e739cf8b1966e8f51de24a94 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Thu, 27 Jun 2024 11:02:01 +0100 Subject: [PATCH 20/23] chore: update dependency to ignore proofs --- Cargo.lock | 10 +++++----- Cargo.toml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2de4fb5fa5d..72de0c611bd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1557,7 +1557,7 @@ dependencies = [ [[package]] name = "crate_crypto_internal_peerdas_bls12_381" version = "0.3.0" -source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=925e90b6806f97b991f784890210a4ad68437208#925e90b6806f97b991f784890210a4ad68437208" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=61946262875ed8d778d3ebb148e770cfae0b06b9#61946262875ed8d778d3ebb148e770cfae0b06b9" dependencies = [ "blst", "blstrs", @@ -1570,7 +1570,7 @@ dependencies = [ [[package]] name = "crate_crypto_internal_peerdas_erasure_codes" version = "0.3.0" -source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=925e90b6806f97b991f784890210a4ad68437208#925e90b6806f97b991f784890210a4ad68437208" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=61946262875ed8d778d3ebb148e770cfae0b06b9#61946262875ed8d778d3ebb148e770cfae0b06b9" dependencies = [ "crate_crypto_internal_peerdas_bls12_381", "crate_crypto_internal_peerdas_polynomial", @@ -1579,7 +1579,7 @@ dependencies = [ [[package]] name = "crate_crypto_internal_peerdas_polynomial" version = "0.3.0" -source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=925e90b6806f97b991f784890210a4ad68437208#925e90b6806f97b991f784890210a4ad68437208" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=61946262875ed8d778d3ebb148e770cfae0b06b9#61946262875ed8d778d3ebb148e770cfae0b06b9" dependencies = [ "crate_crypto_internal_peerdas_bls12_381", ] @@ -1587,7 +1587,7 @@ dependencies = [ [[package]] name = "crate_crypto_kzg_multi_open_fk20" version = "0.3.0" -source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=925e90b6806f97b991f784890210a4ad68437208#925e90b6806f97b991f784890210a4ad68437208" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=61946262875ed8d778d3ebb148e770cfae0b06b9#61946262875ed8d778d3ebb148e770cfae0b06b9" dependencies = [ "crate_crypto_internal_peerdas_bls12_381", "crate_crypto_internal_peerdas_polynomial", @@ -2275,7 +2275,7 @@ dependencies = [ [[package]] name = "eip7594" version = "0.3.0" -source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=925e90b6806f97b991f784890210a4ad68437208#925e90b6806f97b991f784890210a4ad68437208" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=61946262875ed8d778d3ebb148e770cfae0b06b9#61946262875ed8d778d3ebb148e770cfae0b06b9" dependencies = [ "crate_crypto_internal_peerdas_bls12_381", "crate_crypto_internal_peerdas_erasure_codes", diff --git a/Cargo.toml b/Cargo.toml index dac1306afb9..6f21ee61cc8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -99,7 +99,7 @@ delay_map = "0.3" derivative = "2" dirs = "3" either = "1.9" -peerdas-kzg = { git = "https://github.com/crate-crypto/peerdas-kzg", rev = "925e90b6806f97b991f784890210a4ad68437208", package = "eip7594" } +peerdas-kzg = { git = "https://github.com/crate-crypto/peerdas-kzg", rev = "61946262875ed8d778d3ebb148e770cfae0b06b9", package = "eip7594" } discv5 = { version = "0.4.1", features = ["libp2p"] } env_logger = "0.9" error-chain = "0.12" From 6440d788cfa0ee3839e7fb6e08310a97537a4e9c Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Fri, 28 Jun 2024 13:53:13 +0100 Subject: [PATCH 21/23] chore: update peerdas lib to latest --- Cargo.lock | 10 +++++----- Cargo.toml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 72de0c611bd..97f503e63be 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1557,7 +1557,7 @@ dependencies = [ [[package]] name = "crate_crypto_internal_peerdas_bls12_381" version = "0.3.0" -source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=61946262875ed8d778d3ebb148e770cfae0b06b9#61946262875ed8d778d3ebb148e770cfae0b06b9" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=afd76b0385ca1512ffd531ad2d02d6240b1478e5#afd76b0385ca1512ffd531ad2d02d6240b1478e5" dependencies = [ "blst", "blstrs", @@ -1570,7 +1570,7 @@ dependencies = [ [[package]] name = "crate_crypto_internal_peerdas_erasure_codes" version = "0.3.0" -source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=61946262875ed8d778d3ebb148e770cfae0b06b9#61946262875ed8d778d3ebb148e770cfae0b06b9" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=afd76b0385ca1512ffd531ad2d02d6240b1478e5#afd76b0385ca1512ffd531ad2d02d6240b1478e5" dependencies = [ "crate_crypto_internal_peerdas_bls12_381", "crate_crypto_internal_peerdas_polynomial", @@ -1579,7 +1579,7 @@ dependencies = [ [[package]] name = "crate_crypto_internal_peerdas_polynomial" version = "0.3.0" -source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=61946262875ed8d778d3ebb148e770cfae0b06b9#61946262875ed8d778d3ebb148e770cfae0b06b9" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=afd76b0385ca1512ffd531ad2d02d6240b1478e5#afd76b0385ca1512ffd531ad2d02d6240b1478e5" dependencies = [ "crate_crypto_internal_peerdas_bls12_381", ] @@ -1587,7 +1587,7 @@ dependencies = [ [[package]] name = "crate_crypto_kzg_multi_open_fk20" version = "0.3.0" -source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=61946262875ed8d778d3ebb148e770cfae0b06b9#61946262875ed8d778d3ebb148e770cfae0b06b9" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=afd76b0385ca1512ffd531ad2d02d6240b1478e5#afd76b0385ca1512ffd531ad2d02d6240b1478e5" dependencies = [ "crate_crypto_internal_peerdas_bls12_381", "crate_crypto_internal_peerdas_polynomial", @@ -2275,7 +2275,7 @@ dependencies = [ [[package]] name = "eip7594" version = "0.3.0" -source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=61946262875ed8d778d3ebb148e770cfae0b06b9#61946262875ed8d778d3ebb148e770cfae0b06b9" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=afd76b0385ca1512ffd531ad2d02d6240b1478e5#afd76b0385ca1512ffd531ad2d02d6240b1478e5" dependencies = [ "crate_crypto_internal_peerdas_bls12_381", "crate_crypto_internal_peerdas_erasure_codes", diff --git a/Cargo.toml b/Cargo.toml index 6f21ee61cc8..0c0ff4d9e72 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -99,7 +99,7 @@ delay_map = "0.3" derivative = "2" dirs = "3" either = "1.9" -peerdas-kzg = { git = "https://github.com/crate-crypto/peerdas-kzg", rev = "61946262875ed8d778d3ebb148e770cfae0b06b9", package = "eip7594" } +peerdas-kzg = { git = "https://github.com/crate-crypto/peerdas-kzg", rev = "afd76b0385ca1512ffd531ad2d02d6240b1478e5", package = "eip7594" } discv5 = { version = "0.4.1", features = ["libp2p"] } env_logger = "0.9" error-chain = "0.12" From 8570748ed27b6c4be6aefdb26118ade5d0dcbab5 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Thu, 4 Jul 2024 17:44:52 +0100 Subject: [PATCH 22/23] update lib --- Cargo.lock | 11 ++++++----- Cargo.toml | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 97f503e63be..ad63e8f2e56 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1557,7 +1557,7 @@ dependencies = [ [[package]] name = "crate_crypto_internal_peerdas_bls12_381" version = "0.3.0" -source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=afd76b0385ca1512ffd531ad2d02d6240b1478e5#afd76b0385ca1512ffd531ad2d02d6240b1478e5" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=bb8295011cf27dc663699539c7f9a17fe273e896#bb8295011cf27dc663699539c7f9a17fe273e896" dependencies = [ "blst", "blstrs", @@ -1570,7 +1570,7 @@ dependencies = [ [[package]] name = "crate_crypto_internal_peerdas_erasure_codes" version = "0.3.0" -source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=afd76b0385ca1512ffd531ad2d02d6240b1478e5#afd76b0385ca1512ffd531ad2d02d6240b1478e5" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=bb8295011cf27dc663699539c7f9a17fe273e896#bb8295011cf27dc663699539c7f9a17fe273e896" dependencies = [ "crate_crypto_internal_peerdas_bls12_381", "crate_crypto_internal_peerdas_polynomial", @@ -1579,7 +1579,7 @@ dependencies = [ [[package]] name = "crate_crypto_internal_peerdas_polynomial" version = "0.3.0" -source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=afd76b0385ca1512ffd531ad2d02d6240b1478e5#afd76b0385ca1512ffd531ad2d02d6240b1478e5" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=bb8295011cf27dc663699539c7f9a17fe273e896#bb8295011cf27dc663699539c7f9a17fe273e896" dependencies = [ "crate_crypto_internal_peerdas_bls12_381", ] @@ -1587,12 +1587,13 @@ dependencies = [ [[package]] name = "crate_crypto_kzg_multi_open_fk20" version = "0.3.0" -source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=afd76b0385ca1512ffd531ad2d02d6240b1478e5#afd76b0385ca1512ffd531ad2d02d6240b1478e5" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=bb8295011cf27dc663699539c7f9a17fe273e896#bb8295011cf27dc663699539c7f9a17fe273e896" dependencies = [ "crate_crypto_internal_peerdas_bls12_381", "crate_crypto_internal_peerdas_polynomial", "hex", "rayon", + "sha2 0.10.8", ] [[package]] @@ -2275,7 +2276,7 @@ dependencies = [ [[package]] name = "eip7594" version = "0.3.0" -source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=afd76b0385ca1512ffd531ad2d02d6240b1478e5#afd76b0385ca1512ffd531ad2d02d6240b1478e5" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=bb8295011cf27dc663699539c7f9a17fe273e896#bb8295011cf27dc663699539c7f9a17fe273e896" dependencies = [ "crate_crypto_internal_peerdas_bls12_381", "crate_crypto_internal_peerdas_erasure_codes", diff --git a/Cargo.toml b/Cargo.toml index 0c0ff4d9e72..38ca61e5f5d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -99,7 +99,7 @@ delay_map = "0.3" derivative = "2" dirs = "3" either = "1.9" -peerdas-kzg = { git = "https://github.com/crate-crypto/peerdas-kzg", rev = "afd76b0385ca1512ffd531ad2d02d6240b1478e5", package = "eip7594" } +peerdas-kzg = { git = "https://github.com/crate-crypto/peerdas-kzg", rev = "bb8295011cf27dc663699539c7f9a17fe273e896", package = "eip7594" } discv5 = { version = "0.4.1", features = ["libp2p"] } env_logger = "0.9" error-chain = "0.12" From 2b2938ac7582addfd73d3e58eee33728e6a18d6a Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Thu, 4 Jul 2024 17:45:58 +0100 Subject: [PATCH 23/23] chore: remove empty proof parameter --- crypto/kzg/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/kzg/src/lib.rs b/crypto/kzg/src/lib.rs index acafb17262c..9cfe42c8b97 100644 --- a/crypto/kzg/src/lib.rs +++ b/crypto/kzg/src/lib.rs @@ -237,7 +237,7 @@ impl Kzg { let (cells, proofs) = self .context .prover_ctx() - .recover_cells_and_proofs(cell_ids.to_vec(), cells.to_vec(), vec![]) + .recover_cells_and_proofs(cell_ids.to_vec(), cells.to_vec()) .map_err(Error::ProverKZG)?; // Convert the proof type to a c-kzg proof type