mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-19 05:48:31 +00:00
#7330 Removes `c-kzg` from our `kzg` crate and rely fully on the `rust_eth_kzg` crate. This removes the old `Blob` type entirely and instead handles `rust_eth_kzg::KzgBlobRef`s directly which allows us to avoid some extra stack allocations . Similarly, we make `Bytes32` and `Bytes48` type aliases rather than structs as this fits better with the new `rust_eth_kzg` API. Co-Authored-By: Mac L <mjladson@pm.me>
26 lines
946 B
Rust
26 lines
946 B
Rust
use criterion::{criterion_group, criterion_main, Criterion};
|
|
use kzg::trusted_setup::get_trusted_setup;
|
|
use rust_eth_kzg::{DASContext, TrustedSetup as PeerDASTrustedSetup};
|
|
|
|
pub fn bench_init_context(c: &mut Criterion) {
|
|
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_json(trusted_setup_json);
|
|
DASContext::new(
|
|
&trusted_setup,
|
|
rust_eth_kzg::UsePrecomp::Yes {
|
|
width: rust_eth_kzg::constants::RECOMMENDED_PRECOMP_WIDTH,
|
|
},
|
|
)
|
|
})
|
|
});
|
|
}
|
|
|
|
criterion_group!(benches, bench_init_context);
|
|
criterion_main!(benches);
|