mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-21 06:48:27 +00:00
* make kzg field required * update todo * always load trusted setup WIP * fmt * use new rust_eth_kzg version * merge conlficts * add kzg fn with trusted setup disabled * as_slice * add kzg with no precomp * ignore udep for kzg * refactor kzg init * fix peerdas kzg schedule * fix * udeps * uuuudeps * merge conflict resolved * merge conflict * merge conflicts * resolve TODO * update * move kzg to a test util fn * remove trusted setup default impl * lint fmt * fix failing test * lint * fix test * Merge branch 'unstable' into beacon-chain-kzg-field-required
36 lines
1.4 KiB
Rust
36 lines
1.4 KiB
Rust
use c_kzg::KzgSettings;
|
|
use criterion::{criterion_group, criterion_main, Criterion};
|
|
use kzg::{trusted_setup::get_trusted_setup, TrustedSetup};
|
|
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())
|
|
.map_err(|e| format!("Unable to read trusted setup file: {}", e))
|
|
.expect("should have trusted setup");
|
|
|
|
c.bench_function(&format!("Initialize context rust_eth_kzg"), |b| {
|
|
b.iter(|| {
|
|
let trusted_setup = PeerDASTrustedSetup::from(&trusted_setup);
|
|
DASContext::new(
|
|
&trusted_setup,
|
|
rust_eth_kzg::UsePrecomp::Yes {
|
|
width: rust_eth_kzg::constants::RECOMMENDED_PRECOMP_WIDTH,
|
|
},
|
|
)
|
|
})
|
|
});
|
|
c.bench_function(&format!("Initialize context c-kzg (4844)"), |b| {
|
|
b.iter(|| {
|
|
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");
|
|
KzgSettings::load_trusted_setup(&trusted_setup.g1_points(), &trusted_setup.g2_points())
|
|
.unwrap()
|
|
})
|
|
});
|
|
}
|
|
|
|
criterion_group!(benches, bench_init_context);
|
|
criterion_main!(benches);
|