diff --git a/Cargo.lock b/Cargo.lock index c6e2311803c..e4304549f44 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1051,6 +1051,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" @@ -1160,14 +1176,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]] @@ -1539,6 +1555,48 @@ dependencies = [ "libc", ] +[[package]] +name = "crate_crypto_internal_peerdas_bls12_381" +version = "0.3.0" +source = "git+https://github.com/crate-crypto/peerdas-kzg?rev=bb8295011cf27dc663699539c7f9a17fe273e896#bb8295011cf27dc663699539c7f9a17fe273e896" +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=bb8295011cf27dc663699539c7f9a17fe273e896#bb8295011cf27dc663699539c7f9a17fe273e896" +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=bb8295011cf27dc663699539c7f9a17fe273e896#bb8295011cf27dc663699539c7f9a17fe273e896" +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=bb8295011cf27dc663699539c7f9a17fe273e896#bb8295011cf27dc663699539c7f9a17fe273e896" +dependencies = [ + "crate_crypto_internal_peerdas_bls12_381", + "crate_crypto_internal_peerdas_polynomial", + "hex", + "rayon", + "sha2 0.10.8", +] + [[package]] name = "crc32fast" version = "1.4.2" @@ -2216,6 +2274,21 @@ dependencies = [ "types", ] +[[package]] +name = "eip7594" +version = "0.3.0" +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", + "crate_crypto_kzg_multi_open_fk20", + "hex", + "rayon", + "rust-embed", + "serde", + "serde_json", +] + [[package]] name = "either" version = "1.12.0" @@ -2984,6 +3057,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", ] @@ -3419,7 +3493,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 +4136,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" @@ -4312,6 +4422,7 @@ dependencies = [ "arbitrary", "c-kzg", "derivative", + "eip7594", "ethereum_hashing", "ethereum_serde_utils", "ethereum_ssz", @@ -4401,6 +4512,17 @@ version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +[[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" @@ -4411,7 +4533,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]] @@ -5913,6 +6044,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" @@ -6411,6 +6551,12 @@ dependencies = [ "toml_edit 0.21.1", ] +[[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.84" @@ -7058,6 +7204,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.66", + "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.24" @@ -7870,7 +8051,7 @@ checksum = "75062c2738b82cd45ae633623caae3393f43eb00aada1dc2d3ebe88db6b0db9b" dependencies = [ "chrono", "libc", - "libflate", + "libflate 2.1.0", "once_cell", "regex", "serde", diff --git a/Cargo.toml b/Cargo.toml index c44001ec357..6e4a00014b4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -92,16 +92,14 @@ 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 } compare_fields_derive = { path = "common/compare_fields_derive" } criterion = "0.5" delay_map = "0.3" derivative = "2" dirs = "3" either = "1.9" +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" 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 5f6439721f4..9b140ca0652 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( @@ -213,7 +209,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( @@ -239,11 +235,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 @@ -392,8 +384,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)] diff --git a/crypto/kzg/Cargo.toml b/crypto/kzg/Cargo.toml index 2c3c894b49c..1f378c7dc9f 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 } +peerdas-kzg = { workspace = true } mockall = { workspace = true } diff --git a/crypto/kzg/src/lib.rs b/crypto/kzg/src/lib.rs index 9875126700c..9cfe42c8b97 100644 --- a/crypto/kzg/src/lib.rs +++ b/crypto/kzg/src/lib.rs @@ -13,18 +13,23 @@ 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 type CellsAndKzgProofs = ( - Box<[Cell; CELLS_PER_EXT_BLOB]>, - Box<[KzgProof; CELLS_PER_EXT_BLOB]>, -); +pub use peerdas_kzg::{ + constants::{BYTES_PER_CELL, CELLS_PER_EXT_BLOB}, + Cell, CellID, CellRef, TrustedSetup as PeerDASTrustedSetup, +}; +use peerdas_kzg::{prover::ProverError, verifier::VerifierError, PeerDASContext}; +pub type CellsAndKzgProofs = ([Cell; CELLS_PER_EXT_BLOB], [KzgProof; CELLS_PER_EXT_BLOB]); #[derive(Debug)] pub enum Error { /// An error from the underlying kzg library. Kzg(c_kzg::Error), + /// A prover error from the PeerdasKZG library + ProverKZG(ProverError), + /// A verifier error from the PeerdasKZG library + VerifierKZG(VerifierError), /// The kzg verification failed KzgVerificationFailed, /// Misc indexing error @@ -41,20 +46,31 @@ impl From for Error { #[derive(Debug)] pub struct Kzg { trusted_setup: KzgSettings, + context: PeerDASContext, } #[automock] 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(), - // Enable precomputed table for 8 bits, with 96MB of memory overhead per process - // Ref: https://notes.ethereum.org/@jtraglia/windowed_multiplications - 8, )?, + context, }) } @@ -158,10 +174,20 @@ impl Kzg { /// Computes the cells and associated proofs for a given `blob` at index `index`. pub fn compute_cells_and_proofs(&self, blob: &Blob) -> Result { - 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)) + 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(KzgProof); + Ok((cells, c_kzg_proof)) } /// Verifies a batch of cell-proof-commitment triplets. @@ -169,55 +195,67 @@ 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( + #[allow(clippy::needless_lifetimes)] + 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()).collect(); + let commitments: Vec<_> = kzg_commitments + .iter() + .map(|commitment| commitment.as_ref()) + .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( + #[allow(clippy::needless_lifetimes)] + pub fn recover_cells_and_compute_kzg_proofs<'a>( &self, cell_ids: &[u64], - cells: &[Cell], + cells: &[CellRef<'a>], ) -> Result { - 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) + let (cells, proofs) = self + .context + .prover_ctx() + .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 + let c_kzg_proof = proofs.map(KzgProof); + Ok((cells, c_kzg_proof)) } } pub mod mock { - use crate::{CellsAndKzgProofs, Error, KzgProof}; - use c_kzg::{Blob, Cell, CELLS_PER_EXT_BLOB}; - - pub const MOCK_KZG_BYTES_PER_CELL: usize = 2048; + use crate::{Blob, Cell, CellsAndKzgProofs, BYTES_PER_CELL, CELLS_PER_EXT_BLOB}; + use crate::{Error, KzgProof}; + #[allow(clippy::type_complexity)] pub fn compute_cells_and_proofs(_blob: &Blob) -> Result { - 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]), - )) + 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])) } } 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..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,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!( 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!(