diff --git a/Cargo.lock b/Cargo.lock index 74ae8d1720..3bd3a906a6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -900,6 +900,7 @@ dependencies = [ "eth2_config", "eth2_libp2p", "eth2_ssz", + "execution_layer", "futures", "genesis", "http_api", diff --git a/beacon_node/client/Cargo.toml b/beacon_node/client/Cargo.toml index 7b84f4a492..9cdd47e670 100644 --- a/beacon_node/client/Cargo.toml +++ b/beacon_node/client/Cargo.toml @@ -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" } diff --git a/beacon_node/client/src/builder.rs b/beacon_node/client/src/builder.rs index 7f19dbb85d..4ae896fd30 100644 --- a/beacon_node/client/src/builder.rs +++ b/beacon_node/client/src/builder.rs @@ -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(), diff --git a/beacon_node/client/src/config.rs b/beacon_node/client/src/config.rs index 40e13898b9..28af34da2c 100644 --- a/beacon_node/client/src/config.rs +++ b/beacon_node/client/src/config.rs @@ -74,6 +74,7 @@ pub struct Config { pub network: network::NetworkConfig, pub chain: beacon_chain::ChainConfig, pub eth1: eth1::Config, + pub execution_endpoints: Option>, pub http_api: http_api::Config, pub http_metrics: http_metrics::Config, pub monitoring_api: Option, @@ -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(),