Upgrade rust-eth-kzg to 0.8.0 (#7870)

#7864

The main breaking change in v0.8.0 is the `TrustedSetup` initialisation - it now requires a json string via `PeerDASTrustedSetup::from_json`.
This commit is contained in:
Jimmy Chen
2025-08-18 12:52:39 +10:00
committed by GitHub
parent 9200042910
commit aa8cba3741
14 changed files with 185 additions and 192 deletions

179
Cargo.lock generated
View File

@@ -1841,58 +1841,6 @@ dependencies = [
"libc",
]
[[package]]
name = "crate_crypto_internal_eth_kzg_bls12_381"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76f9cdad245e39a3659bc4c8958e93de34bd31ba3131ead14ccfb4b2cd60e52d"
dependencies = [
"blst",
"blstrs",
"ff 0.13.1",
"group 0.13.0",
"pairing",
"subtle",
]
[[package]]
name = "crate_crypto_internal_eth_kzg_erasure_codes"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "581d28bcc93eecd97a04cebc5293271e0f41650f03c102f24d6cd784cbedb9f2"
dependencies = [
"crate_crypto_internal_eth_kzg_bls12_381",
"crate_crypto_internal_eth_kzg_polynomial",
]
[[package]]
name = "crate_crypto_internal_eth_kzg_maybe_rayon"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06fc0f984e585ea984a766c5b58d6bf6c51e463b0a0835b0dd4652d358b506b3"
[[package]]
name = "crate_crypto_internal_eth_kzg_polynomial"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56dff7a45e2d80308b21abdbc5520ec23c3ebfb3a94fafc02edfa7f356af6d7f"
dependencies = [
"crate_crypto_internal_eth_kzg_bls12_381",
]
[[package]]
name = "crate_crypto_kzg_multi_open_fk20"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a0c2f82695a88809e713e1ff9534cb90ceffab0a08f4bd33245db711f9d356f"
dependencies = [
"crate_crypto_internal_eth_kzg_bls12_381",
"crate_crypto_internal_eth_kzg_maybe_rayon",
"crate_crypto_internal_eth_kzg_polynomial",
"hex",
"sha2 0.10.8",
]
[[package]]
name = "crc"
version = "3.2.1"
@@ -2616,12 +2564,117 @@ dependencies = [
"types",
]
[[package]]
name = "eip4844"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0067055675ea62c0287d520099d9a560f5ad4fd0c00956da99bbb2a68ad2bfc9"
dependencies = [
"ekzg-bls12-381",
"ekzg-maybe-rayon",
"ekzg-polynomial",
"ekzg-serialization",
"ekzg-single-open",
"ekzg-trusted-setup",
"hex",
"itertools 0.14.0",
"serde",
"serde_json",
"sha2 0.10.8",
]
[[package]]
name = "either"
version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
[[package]]
name = "ekzg-bls12-381"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef34382b1387ebc5acb0d509ab88401beade921af5982142778ae0c200f71edf"
dependencies = [
"blst",
"blstrs",
"ff 0.13.1",
"group 0.13.0",
"pairing",
"subtle",
]
[[package]]
name = "ekzg-erasure-codes"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fa58fcb3f698451a3a1ceb5f4a13ea7a4decab9f0bad63ee1690671b12b901c"
dependencies = [
"ekzg-bls12-381",
"ekzg-polynomial",
]
[[package]]
name = "ekzg-maybe-rayon"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ce7a570aaa7eb80ea92637f7153a8cd4c20640a3043146b57590ab4ae8eb0e9"
[[package]]
name = "ekzg-multi-open"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51a24896816c59dde1cf08b67480114edb9df1738b7f4f99ec51f7ce0e2dfaa0"
dependencies = [
"ekzg-bls12-381",
"ekzg-maybe-rayon",
"ekzg-polynomial",
"sha2 0.10.8",
]
[[package]]
name = "ekzg-polynomial"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6520b5210781436d42ec6cb2e3a278573f1af10707b92502f5329ec967d30018"
dependencies = [
"ekzg-bls12-381",
"ekzg-maybe-rayon",
]
[[package]]
name = "ekzg-serialization"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bcf1197575ca1babbd7861424e7c5339233fa8215cf8b1ee9188a2c354f34b6a"
dependencies = [
"ekzg-bls12-381",
"hex",
]
[[package]]
name = "ekzg-single-open"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f6e471860c94135d9075562a991c4456c4148efdac2bfccc64e1bf3fd074beb"
dependencies = [
"ekzg-bls12-381",
"ekzg-polynomial",
"itertools 0.14.0",
]
[[package]]
name = "ekzg-trusted-setup"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1b016cc437c85ece6d54ecfe51b745516e520b388beb2b09a5196748bab21f3"
dependencies = [
"ekzg-bls12-381",
"ekzg-serialization",
"hex",
"serde",
"serde_json",
]
[[package]]
name = "elliptic-curve"
version = "0.12.3"
@@ -4885,6 +4938,15 @@ dependencies = [
"either",
]
[[package]]
name = "itertools"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
dependencies = [
"either",
]
[[package]]
name = "itoa"
version = "1.0.15"
@@ -8029,13 +8091,16 @@ dependencies = [
[[package]]
name = "rust_eth_kzg"
version = "0.5.4"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f83b5559e1dcd3f7721838909288faf4500fb466eff98eac99b67ac04335b93"
checksum = "5c552fbda8be95ddcbebc9ebcb198cb9fe97e538450bcb7476ce5d9e03c499ff"
dependencies = [
"crate_crypto_internal_eth_kzg_bls12_381",
"crate_crypto_internal_eth_kzg_erasure_codes",
"crate_crypto_kzg_multi_open_fk20",
"eip4844",
"ekzg-bls12-381",
"ekzg-erasure-codes",
"ekzg-multi-open",
"ekzg-serialization",
"ekzg-trusted-setup",
"hex",
"serde",
"serde_json",

View File

@@ -220,7 +220,7 @@ reqwest = { version = "0.11", default-features = false, features = [
ring = "0.17"
rpds = "0.11"
rusqlite = { version = "0.28", features = ["bundled"] }
rust_eth_kzg = "0.5.4"
rust_eth_kzg = "0.8.0"
safe_arith = { path = "consensus/safe_arith" }
sensitive_url = { path = "common/sensitive_url" }
serde = { version = "1", features = ["derive"] }

View File

@@ -423,7 +423,7 @@ mod test {
use bls::Signature;
use eth2::types::BlobsBundle;
use execution_layer::test_utils::generate_blobs;
use kzg::{Kzg, KzgCommitment, TrustedSetup, trusted_setup::get_trusted_setup};
use kzg::{Kzg, KzgCommitment, trusted_setup::get_trusted_setup};
use types::{
BeaconBlock, BeaconBlockFulu, BlobsList, ChainSpec, EmptyBlock, EthSpec, ForkName,
FullPayload, KzgProofs, MainnetEthSpec, SignedBeaconBlock,
@@ -569,10 +569,7 @@ mod test {
}
fn get_kzg() -> Kzg {
let trusted_setup: TrustedSetup = serde_json::from_reader(get_trusted_setup().as_slice())
.map_err(|e| format!("Unable to read trusted setup file: {}", e))
.expect("should have trusted setup");
Kzg::new_from_trusted_setup_das_enabled(trusted_setup).expect("should create kzg")
Kzg::new_from_trusted_setup(&get_trusted_setup()).expect("should create kzg")
}
fn create_test_fulu_block_and_blobs<E: EthSpec>(

View File

@@ -32,8 +32,8 @@ use execution_layer::{
use futures::channel::mpsc::Receiver;
pub use genesis::{DEFAULT_ETH1_BLOCK_HASH, InteropGenesisBuilder};
use int_to_bytes::int_to_bytes32;
use kzg::Kzg;
use kzg::trusted_setup::get_trusted_setup;
use kzg::{Kzg, TrustedSetup};
use logging::create_test_tracing_subscriber;
use merkle_proof::MerkleTree;
use operation_pool::ReceivedPreCapella;
@@ -81,33 +81,18 @@ pub const TEST_DATA_COLUMN_SIDECARS_SSZ: &[u8] =
pub const DEFAULT_TARGET_AGGREGATORS: u64 = u64::MAX;
static KZG: LazyLock<Arc<Kzg>> = LazyLock::new(|| {
let trusted_setup: TrustedSetup = serde_json::from_reader(get_trusted_setup().as_slice())
.map_err(|e| format!("Unable to read trusted setup file: {}", e))
.expect("should have trusted setup");
let kzg = Kzg::new_from_trusted_setup(trusted_setup).expect("should create kzg");
Arc::new(kzg)
});
static KZG_PEERDAS: LazyLock<Arc<Kzg>> = LazyLock::new(|| {
let trusted_setup: TrustedSetup = serde_json::from_reader(get_trusted_setup().as_slice())
.map_err(|e| format!("Unable to read trusted setup file: {}", e))
.expect("should have trusted setup");
let kzg = Kzg::new_from_trusted_setup_das_enabled(trusted_setup).expect("should create kzg");
let kzg = Kzg::new_from_trusted_setup(&get_trusted_setup()).expect("should create kzg");
Arc::new(kzg)
});
static KZG_NO_PRECOMP: LazyLock<Arc<Kzg>> = LazyLock::new(|| {
let trusted_setup: TrustedSetup = serde_json::from_reader(get_trusted_setup().as_slice())
.map_err(|e| format!("Unable to read trusted setup file: {}", e))
.expect("should have trusted setup");
let kzg = Kzg::new_from_trusted_setup_no_precomp(trusted_setup).expect("should create kzg");
let kzg =
Kzg::new_from_trusted_setup_no_precomp(&get_trusted_setup()).expect("should create kzg");
Arc::new(kzg)
});
pub fn get_kzg(spec: &ChainSpec) -> Arc<Kzg> {
if spec.fulu_fork_epoch.is_some() {
KZG_PEERDAS.clone()
} else if spec.deneb_fork_epoch.is_some() {
KZG.clone()
} else {
KZG_NO_PRECOMP.clone()

View File

@@ -185,13 +185,10 @@ where
};
let kzg_err_msg = |e| format!("Failed to load trusted setup: {:?}", e);
let trusted_setup = config.trusted_setup.clone();
let kzg = if spec.is_peer_das_scheduled() {
Kzg::new_from_trusted_setup_das_enabled(trusted_setup).map_err(kzg_err_msg)?
} else if spec.deneb_fork_epoch.is_some() {
Kzg::new_from_trusted_setup(trusted_setup).map_err(kzg_err_msg)?
Kzg::new_from_trusted_setup(&config.trusted_setup).map_err(kzg_err_msg)?
} else {
Kzg::new_from_trusted_setup_no_precomp(trusted_setup).map_err(kzg_err_msg)?
Kzg::new_from_trusted_setup_no_precomp(&config.trusted_setup).map_err(kzg_err_msg)?
};
let builder = BeaconChainBuilder::new(eth_spec_instance, Arc::new(kzg))

View File

@@ -1,4 +1,3 @@
use beacon_chain::TrustedSetup;
use beacon_chain::graffiti_calculator::GraffitiOrigin;
use beacon_chain::validator_monitor::ValidatorMonitorConfig;
use beacon_processor::BeaconProcessorConfig;
@@ -70,7 +69,7 @@ pub struct Config {
pub network: network::NetworkConfig,
pub chain: beacon_chain::ChainConfig,
pub execution_layer: Option<execution_layer::Config>,
pub trusted_setup: TrustedSetup,
pub trusted_setup: Vec<u8>,
pub http_api: http_api::Config,
pub http_metrics: http_metrics::Config,
pub monitoring_api: Option<monitoring_api::Config>,
@@ -84,9 +83,6 @@ pub struct Config {
impl Default for Config {
fn default() -> Self {
let trusted_setup: TrustedSetup = serde_json::from_reader(get_trusted_setup().as_slice())
.expect("Unable to read trusted setup file");
Self {
data_dir: PathBuf::from(DEFAULT_ROOT_DIR),
db_name: "chain_db".to_string(),
@@ -98,7 +94,7 @@ impl Default for Config {
network: NetworkConfig::default(),
chain: <_>::default(),
execution_layer: None,
trusted_setup,
trusted_setup: get_trusted_setup(),
beacon_graffiti: GraffitiOrigin::default(),
http_api: <_>::default(),
http_metrics: <_>::default(),

View File

@@ -937,7 +937,7 @@ pub fn generate_pow_block(
#[cfg(test)]
mod test {
use super::*;
use kzg::{Bytes48, CellRef, KzgBlobRef, TrustedSetup, trusted_setup::get_trusted_setup};
use kzg::{Bytes48, CellRef, KzgBlobRef, trusted_setup::get_trusted_setup};
use types::{MainnetEthSpec, MinimalEthSpec};
#[test]
@@ -1056,10 +1056,7 @@ mod test {
}
fn load_kzg() -> Result<Kzg, String> {
let trusted_setup: TrustedSetup =
serde_json::from_reader(get_trusted_setup().as_slice())
.map_err(|e| format!("Unable to read trusted setup file: {e:?}"))?;
Kzg::new_from_trusted_setup(trusted_setup)
Kzg::new_from_trusted_setup(&get_trusted_setup())
.map_err(|e| format!("Failed to load trusted setup: {e:?}"))
}
}

View File

@@ -1,5 +1,4 @@
use account_utils::{STDIN_INPUTS_FLAG, read_input_from_user};
use beacon_chain::TrustedSetup;
use beacon_chain::chain_config::{
DEFAULT_PREPARE_PAYLOAD_LOOKAHEAD_FACTOR, DEFAULT_RE_ORG_HEAD_THRESHOLD,
DEFAULT_RE_ORG_MAX_EPOCHS_SINCE_FINALIZATION, DEFAULT_RE_ORG_PARENT_THRESHOLD,
@@ -349,25 +348,13 @@ pub fn get_config<E: EthSpec>(
// Store the EL config in the client config.
client_config.execution_layer = Some(el_config);
// 4844 params
if let Some(trusted_setup) = context
.eth2_network_config
.as_ref()
.map(|config| serde_json::from_slice(&config.kzg_trusted_setup))
.transpose()
.map_err(|e| format!("Unable to read trusted setup file: {}", e))?
{
client_config.trusted_setup = trusted_setup;
};
// Override default trusted setup file if required
if let Some(trusted_setup_file_path) = cli_args.get_one::<String>("trusted-setup-file-override")
{
let file = std::fs::File::open(trusted_setup_file_path)
.map_err(|e| format!("Failed to open trusted setup file: {}", e))?;
let trusted_setup: TrustedSetup = serde_json::from_reader(file)
.map_err(|e| format!("Unable to read trusted setup file: {}", e))?;
client_config.trusted_setup = trusted_setup;
client_config.trusted_setup = std::fs::read(trusted_setup_file_path)
.map_err(|e| format!("Failed to read trusted setup file: {}", e))?;
} else if let Some(eth2_network_config) = context.eth2_network_config.as_ref() {
client_config.trusted_setup = eth2_network_config.kzg_trusted_setup.clone();
}
if let Some(freezer_dir) = cli_args.get_one::<String>("freezer-dir") {

View File

@@ -4,13 +4,14 @@ use kzg::{trusted_setup::get_trusted_setup, TrustedSetup, NO_PRECOMPUTE};
use rust_eth_kzg::{DASContext, TrustedSetup as PeerDASTrustedSetup};
pub fn bench_init_context(c: &mut Criterion) {
let trusted_setup: TrustedSetup = serde_json::from_reader(get_trusted_setup().as_slice())
let trusted_setup_bytes = get_trusted_setup();
let trusted_setup_json = std::str::from_utf8(&trusted_setup_bytes)
.map_err(|e| format!("Unable to read trusted setup file: {}", e))
.expect("should have trusted setup");
c.bench_function("Initialize context rust_eth_kzg", |b| {
b.iter(|| {
let trusted_setup = PeerDASTrustedSetup::from(&trusted_setup);
let trusted_setup = PeerDASTrustedSetup::from_json(trusted_setup_json);
DASContext::new(
&trusted_setup,
rust_eth_kzg::UsePrecomp::Yes {
@@ -22,7 +23,7 @@ pub fn bench_init_context(c: &mut Criterion) {
c.bench_function("Initialize context c-kzg (4844)", |b| {
b.iter(|| {
let trusted_setup: TrustedSetup =
serde_json::from_reader(get_trusted_setup().as_slice())
serde_json::from_reader(trusted_setup_bytes.as_slice())
.map_err(|e| format!("Unable to read trusted setup file: {}", e))
.expect("should have trusted setup");
KzgSettings::load_trusted_setup(

View File

@@ -16,6 +16,7 @@ pub use c_kzg::{
BYTES_PER_FIELD_ELEMENT, BYTES_PER_PROOF, FIELD_ELEMENTS_PER_BLOB,
};
use crate::trusted_setup::load_trusted_setup;
pub use rust_eth_kzg::{
constants::{BYTES_PER_CELL, CELLS_PER_EXT_BLOB},
Cell, CellIndex as CellID, CellRef, TrustedSetup as PeerDASTrustedSetup,
@@ -37,6 +38,8 @@ pub type KzgBlobRef<'a> = &'a [u8; BYTES_PER_BLOB];
#[derive(Debug)]
pub enum Error {
/// An error from initialising the trusted setup.
TrustedSetupError(String),
/// An error from the underlying kzg library.
Kzg(c_kzg::Error),
/// A prover/verifier error from the rust-eth-kzg library.
@@ -65,16 +68,15 @@ pub struct Kzg {
}
impl Kzg {
pub fn new_from_trusted_setup_no_precomp(trusted_setup: TrustedSetup) -> Result<Self, Error> {
let peerdas_trusted_setup = PeerDASTrustedSetup::from(&trusted_setup);
let context = DASContext::new(&peerdas_trusted_setup, rust_eth_kzg::UsePrecomp::No);
pub fn new_from_trusted_setup_no_precomp(trusted_setup: &[u8]) -> Result<Self, Error> {
let (ckzg_trusted_setup, rkzg_trusted_setup) = load_trusted_setup(trusted_setup)?;
let context = DASContext::new(&rkzg_trusted_setup, rust_eth_kzg::UsePrecomp::No);
Ok(Self {
trusted_setup: KzgSettings::load_trusted_setup(
&trusted_setup.g1_monomial(),
&trusted_setup.g1_lagrange(),
&trusted_setup.g2_monomial(),
&ckzg_trusted_setup.g1_monomial(),
&ckzg_trusted_setup.g1_lagrange(),
&ckzg_trusted_setup.g2_monomial(),
NO_PRECOMPUTE,
)?,
context,
@@ -82,39 +84,14 @@ 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<Self, Error> {
let peerdas_trusted_setup = PeerDASTrustedSetup::from(&trusted_setup);
let context = DASContext::new(
&peerdas_trusted_setup,
rust_eth_kzg::UsePrecomp::Yes {
width: rust_eth_kzg::constants::RECOMMENDED_PRECOMP_WIDTH,
},
);
Ok(Self {
trusted_setup: KzgSettings::load_trusted_setup(
&trusted_setup.g1_monomial(),
&trusted_setup.g1_lagrange(),
&trusted_setup.g2_monomial(),
NO_PRECOMPUTE,
)?,
context,
})
}
pub fn new_from_trusted_setup_das_enabled(trusted_setup: TrustedSetup) -> Result<Self, Error> {
// 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::from(&trusted_setup);
pub fn new_from_trusted_setup(trusted_setup: &[u8]) -> Result<Self, Error> {
let (ckzg_trusted_setup, rkzg_trusted_setup) = load_trusted_setup(trusted_setup)?;
// It's not recommended to change the config parameter for precomputation as storage
// grows exponentially, but the speedup is exponential - after a while the speedup
// starts to become sublinear.
let context = DASContext::new(
&peerdas_trusted_setup,
&rkzg_trusted_setup,
rust_eth_kzg::UsePrecomp::Yes {
width: rust_eth_kzg::constants::RECOMMENDED_PRECOMP_WIDTH,
},
@@ -122,9 +99,9 @@ impl Kzg {
Ok(Self {
trusted_setup: KzgSettings::load_trusted_setup(
&trusted_setup.g1_monomial(),
&trusted_setup.g1_lagrange(),
&trusted_setup.g2_monomial(),
&ckzg_trusted_setup.g1_monomial(),
&ckzg_trusted_setup.g1_lagrange(),
&ckzg_trusted_setup.g2_monomial(),
NO_PRECOMPUTE,
)?,
context,
@@ -266,7 +243,7 @@ impl Kzg {
.collect();
let verification_result = self.context().verify_cell_kzg_proof_batch(
commitments.to_vec(),
columns,
&columns,
cells.to_vec(),
proofs.to_vec(),
);
@@ -274,7 +251,7 @@ impl Kzg {
// Modify the result so it matches roughly what the previous method was doing.
match verification_result {
Ok(_) => Ok(()),
Err(e) if e.invalid_proof() => Err(Error::KzgVerificationFailed),
Err(e) if e.is_proof_invalid() => Err(Error::KzgVerificationFailed),
Err(e) => Err(Error::PeerDASKZG(e)),
}
}

View File

@@ -1,4 +1,4 @@
use crate::PeerDASTrustedSetup;
use crate::{Error, PeerDASTrustedSetup};
use serde::{
de::{self, Deserializer, Visitor},
Deserialize, Serialize,
@@ -55,28 +55,6 @@ impl TrustedSetup {
}
}
impl From<&TrustedSetup> for PeerDASTrustedSetup {
fn from(trusted_setup: &TrustedSetup) -> Self {
Self {
g1_monomial: trusted_setup
.g1_monomial
.iter()
.map(|g1_point| format!("0x{}", hex::encode(g1_point.0)))
.collect::<Vec<_>>(),
g1_lagrange: trusted_setup
.g1_lagrange
.iter()
.map(|g1_point| format!("0x{}", hex::encode(g1_point.0)))
.collect::<Vec<_>>(),
g2_monomial: trusted_setup
.g2_monomial
.iter()
.map(|g2_point| format!("0x{}", hex::encode(g2_point.0)))
.collect::<Vec<_>>(),
}
}
}
impl Serialize for G1Point {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
@@ -176,3 +154,20 @@ fn strip_prefix(s: &str) -> &str {
s
}
}
/// Loads the trusted setup from JSON.
///
/// ## Note:
/// Currently we load both c-kzg and rust-eth-kzg trusted setup structs, because c-kzg is still being
/// used for 4844. Longer term we're planning to switch all KZG operations to the rust-eth-kzg
/// crate, and we'll be able to maintain a single trusted setup struct.
pub(crate) fn load_trusted_setup(
trusted_setup: &[u8],
) -> Result<(TrustedSetup, PeerDASTrustedSetup), Error> {
let ckzg_trusted_setup: TrustedSetup = serde_json::from_slice(trusted_setup)
.map_err(|e| Error::TrustedSetupError(format!("{e:?}")))?;
let trusted_setup_json = std::str::from_utf8(trusted_setup)
.map_err(|e| Error::TrustedSetupError(format!("{e:?}")))?;
let rkzg_trusted_setup = PeerDASTrustedSetup::from_json(trusted_setup_json);
Ok((ckzg_trusted_setup, rkzg_trusted_setup))
}

View File

@@ -2,10 +2,9 @@ participants:
- cl_type: lighthouse
cl_image: lighthouse:local
el_type: geth
el_image: ethpandaops/geth:fusaka-devnet-1
el_image: ethpandaops/geth:fusaka-devnet-3
supernode: true
cl_extra_params:
- --subscribe-all-data-column-subnets
- --subscribe-all-subnets
# Note: useful for testing range sync (only produce block if the node is in sync to prevent forking)
- --sync-tolerance-epochs=0
- --target-peers=3
@@ -13,7 +12,8 @@ participants:
- cl_type: lighthouse
cl_image: lighthouse:local
el_type: geth
el_image: ethpandaops/geth:fusaka-devnet-1
el_image: ethpandaops/geth:fusaka-devnet-3
supernode: false
cl_extra_params:
# Note: useful for testing range sync (only produce block if the node is in sync to prevent forking)
- --sync-tolerance-epochs=0

View File

@@ -2,7 +2,7 @@ use super::*;
use crate::case_result::compare_result;
use beacon_chain::kzg_utils::validate_blob;
use kzg::trusted_setup::get_trusted_setup;
use kzg::{Cell, Error as KzgError, Kzg, KzgCommitment, KzgProof, TrustedSetup};
use kzg::{Cell, Error as KzgError, Kzg, KzgCommitment, KzgProof};
use serde::Deserialize;
use std::marker::PhantomData;
use std::sync::Arc;
@@ -10,10 +10,7 @@ use std::sync::LazyLock;
use types::Blob;
static KZG: LazyLock<Arc<Kzg>> = LazyLock::new(|| {
let trusted_setup: TrustedSetup = serde_json::from_reader(get_trusted_setup().as_slice())
.map_err(|e| Error::InternalError(format!("Failed to initialize trusted setup: {:?}", e)))
.expect("failed to initialize trusted setup");
let kzg = Kzg::new_from_trusted_setup_das_enabled(trusted_setup)
let kzg = Kzg::new_from_trusted_setup(&get_trusted_setup())
.map_err(|e| Error::InternalError(format!("Failed to initialize kzg: {:?}", e)))
.expect("failed to initialize kzg");
Arc::new(kzg)

View File

@@ -46,8 +46,7 @@ fn default_client_config(network_params: LocalNetworkParams, genesis_time: u64)
beacon_config.network.discv5_config.enable_packet_filter = false;
beacon_config.chain.enable_light_client_server = true;
beacon_config.chain.optimistic_finalized_sync = false;
beacon_config.trusted_setup = serde_json::from_reader(get_trusted_setup().as_slice())
.expect("Trusted setup bytes should be valid");
beacon_config.trusted_setup = get_trusted_setup();
let el_config = execution_layer::Config {
execution_endpoint: Some(