Merge branch 'unstable' into max-blobs-preset

This commit is contained in:
Pawan Dhananjay
2024-10-21 14:46:00 -07:00
287 changed files with 10187 additions and 9415 deletions

View File

@@ -20,6 +20,7 @@ types = { workspace = true }
eth2_config = { workspace = true }
slot_clock = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
error-chain = { workspace = true }
slog = { workspace = true }
tokio = { workspace = true }
@@ -27,6 +28,7 @@ futures = { workspace = true }
dirs = { workspace = true }
eth1 = { workspace = true }
eth2 = { workspace = true }
kzg = { workspace = true }
sensitive_url = { workspace = true }
genesis = { workspace = true }
task_executor = { workspace = true }

View File

@@ -75,7 +75,7 @@ pub struct ClientBuilder<T: BeaconChainTypes> {
#[allow(clippy::type_complexity)]
store: Option<Arc<HotColdDB<T::EthSpec, T::HotStore, T::ColdStore>>>,
runtime_context: Option<RuntimeContext<T::EthSpec>>,
chain_spec: Option<ChainSpec>,
chain_spec: Option<Arc<ChainSpec>>,
beacon_chain_builder: Option<BeaconChainBuilder<T>>,
beacon_chain: Option<Arc<BeaconChain<T>>>,
eth1_service: Option<Eth1Service>,
@@ -136,7 +136,7 @@ where
}
/// Specifies the `ChainSpec`.
pub fn chain_spec(mut self, spec: ChainSpec) -> Self {
pub fn chain_spec(mut self, spec: Arc<ChainSpec>) -> Self {
self.chain_spec = Some(spec);
self
}
@@ -194,7 +194,17 @@ where
None
};
let builder = BeaconChainBuilder::new(eth_spec_instance)
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)?
} else {
Kzg::new_from_trusted_setup_no_precomp(trusted_setup).map_err(kzg_err_msg)?
};
let builder = BeaconChainBuilder::new(eth_spec_instance, Arc::new(kzg))
.logger(context.log().clone())
.store(store)
.task_executor(context.executor.clone())
@@ -594,10 +604,9 @@ where
};
let genesis_state = genesis_service
.wait_for_genesis_state(
Duration::from_millis(ETH1_GENESIS_UPDATE_INTERVAL_MILLIS),
context.eth2_config().spec.clone(),
)
.wait_for_genesis_state(Duration::from_millis(
ETH1_GENESIS_UPDATE_INTERVAL_MILLIS,
))
.await?;
let _ = exit_tx.send(());
@@ -623,20 +632,6 @@ where
ClientGenesis::FromStore => builder.resume_from_db().map(|v| (v, None))?,
};
let beacon_chain_builder = if let Some(trusted_setup) = config.trusted_setup {
let kzg_err_msg = |e| format!("Failed to load trusted setup: {:?}", e);
let kzg = if spec.is_peer_das_scheduled() {
Kzg::new_from_trusted_setup_das_enabled(trusted_setup).map_err(kzg_err_msg)?
} else {
Kzg::new_from_trusted_setup(trusted_setup).map_err(kzg_err_msg)?
};
beacon_chain_builder.kzg(Some(Arc::new(kzg)))
} else {
beacon_chain_builder
};
if config.sync_eth1_chain {
self.eth1_service = eth1_service_option;
}
@@ -645,7 +640,7 @@ where
}
/// Starts the networking stack.
pub async fn network(mut self, config: &NetworkConfig) -> Result<Self, String> {
pub async fn network(mut self, config: Arc<NetworkConfig>) -> Result<Self, String> {
let beacon_chain = self
.beacon_chain
.clone()

View File

@@ -4,6 +4,7 @@ use beacon_chain::TrustedSetup;
use beacon_processor::BeaconProcessorConfig;
use directory::DEFAULT_ROOT_DIR;
use environment::LoggerConfig;
use kzg::trusted_setup::get_trusted_setup;
use network::NetworkConfig;
use sensitive_url::SensitiveUrl;
use serde::{Deserialize, Serialize};
@@ -75,7 +76,7 @@ pub struct Config {
pub chain: beacon_chain::ChainConfig,
pub eth1: eth1::Config,
pub execution_layer: Option<execution_layer::Config>,
pub trusted_setup: Option<TrustedSetup>,
pub trusted_setup: TrustedSetup,
pub http_api: http_api::Config,
pub http_metrics: http_metrics::Config,
pub monitoring_api: Option<monitoring_api::Config>,
@@ -89,6 +90,9 @@ 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(),
@@ -103,7 +107,7 @@ impl Default for Config {
sync_eth1_chain: false,
eth1: <_>::default(),
execution_layer: None,
trusted_setup: None,
trusted_setup,
beacon_graffiti: GraffitiOrigin::default(),
http_api: <_>::default(),
http_metrics: <_>::default(),

View File

@@ -436,7 +436,7 @@ async fn capella_readiness_logging<T: BeaconChainTypes>(
.snapshot
.beacon_state
.fork_name_unchecked()
>= ForkName::Capella;
.capella_enabled();
let has_execution_layer = beacon_chain.execution_layer.is_some();
@@ -496,7 +496,7 @@ async fn deneb_readiness_logging<T: BeaconChainTypes>(
.snapshot
.beacon_state
.fork_name_unchecked()
>= ForkName::Deneb;
.deneb_enabled();
let has_execution_layer = beacon_chain.execution_layer.is_some();