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

@@ -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(),