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 4e56b2b44c3..748dac57cde 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 @@ -5,14 +5,20 @@ use eth2_network_config::TRUSTED_SETUP_BYTES; use kzg::{Cell, Error as KzgError, Kzg, KzgCommitment, KzgProof, TrustedSetup}; use serde::Deserialize; use std::marker::PhantomData; +use std::sync::Arc; +use std::sync::LazyLock; use types::Blob; -pub fn get_kzg() -> Result { - let trusted_setup: TrustedSetup = serde_json::from_reader(TRUSTED_SETUP_BYTES) - .map_err(|e| Error::InternalError(format!("Failed to initialize kzg: {:?}", e)))?; +static KZG: LazyLock> = LazyLock::new(|| { + let trusted_setup: TrustedSetup = + serde_json::from_reader(TRUSTED_SETUP_BYTES).expect("failed to initialize kzg"); // TODO(das): need to enable these tests when rayon issues in rust_eth_kzg are fixed - Kzg::new_from_trusted_setup(trusted_setup) - .map_err(|e| Error::InternalError(format!("Failed to initialize kzg: {:?}", e))) + let kzg = Kzg::new_from_trusted_setup(trusted_setup).expect("failed to initialize kzg"); + Arc::new(kzg) +}); + +pub fn get_kzg() -> Result, Error> { + Ok(Arc::clone(&KZG)) } pub fn parse_cells_and_proofs(