mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 18:32:42 +00:00
Thread execution layer into ClientBuilder
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -900,6 +900,7 @@ dependencies = [
|
||||
"eth2_config",
|
||||
"eth2_libp2p",
|
||||
"eth2_ssz",
|
||||
"execution_layer",
|
||||
"futures",
|
||||
"genesis",
|
||||
"http_api",
|
||||
|
||||
@@ -47,3 +47,5 @@ http_metrics = { path = "../http_metrics" }
|
||||
slasher = { path = "../../slasher" }
|
||||
slasher_service = { path = "../../slasher/service" }
|
||||
monitoring_api = {path = "../../common/monitoring_api"}
|
||||
sensitive_url = { path = "../../common/sensitive_url" }
|
||||
execution_layer = { path = "../execution_layer" }
|
||||
|
||||
@@ -17,6 +17,7 @@ use eth2::{
|
||||
BeaconNodeHttpClient, Error as ApiError, Timeouts,
|
||||
};
|
||||
use eth2_libp2p::NetworkGlobals;
|
||||
use execution_layer::ExecutionLayer;
|
||||
use genesis::{interop_genesis_state, Eth1GenesisService};
|
||||
use monitoring_api::{MonitoringHttpClient, ProcessType};
|
||||
use network::{NetworkConfig, NetworkMessage, NetworkService};
|
||||
@@ -146,6 +147,19 @@ where
|
||||
None
|
||||
};
|
||||
|
||||
let execution_layer = if let Some(execution_endpoints) = config.execution_endpoints {
|
||||
let context = runtime_context.service_context("exec".into());
|
||||
let execution_layer = ExecutionLayer::from_urls(
|
||||
execution_endpoints,
|
||||
context.executor.clone(),
|
||||
context.log().clone(),
|
||||
)
|
||||
.map_err(|e| format!("unable to start execution layer endpoints: {:?}", e))?;
|
||||
Some(execution_layer)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let builder = BeaconChainBuilder::new(eth_spec_instance)
|
||||
.logger(context.log().clone())
|
||||
.store(store)
|
||||
@@ -154,6 +168,7 @@ where
|
||||
.disabled_forks(disabled_forks)
|
||||
.graffiti(graffiti)
|
||||
.event_handler(event_handler)
|
||||
.execution_layer(execution_layer)
|
||||
.monitor_validators(
|
||||
config.validator_monitor_auto,
|
||||
config.validator_monitor_pubkeys.clone(),
|
||||
|
||||
@@ -74,6 +74,7 @@ pub struct Config {
|
||||
pub network: network::NetworkConfig,
|
||||
pub chain: beacon_chain::ChainConfig,
|
||||
pub eth1: eth1::Config,
|
||||
pub execution_endpoints: Option<Vec<SensitiveUrl>>,
|
||||
pub http_api: http_api::Config,
|
||||
pub http_metrics: http_metrics::Config,
|
||||
pub monitoring_api: Option<monitoring_api::Config>,
|
||||
@@ -94,6 +95,7 @@ impl Default for Config {
|
||||
dummy_eth1_backend: false,
|
||||
sync_eth1_chain: false,
|
||||
eth1: <_>::default(),
|
||||
execution_endpoints: None,
|
||||
disabled_forks: Vec::new(),
|
||||
graffiti: Graffiti::default(),
|
||||
http_api: <_>::default(),
|
||||
|
||||
Reference in New Issue
Block a user