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

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(