mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 20:57:10 +00:00
resolve merge conflicts
This commit is contained in:
@@ -476,6 +476,17 @@ pub struct ValidatorClient {
|
||||
)]
|
||||
pub beacon_nodes_sync_tolerances: Vec<u64>,
|
||||
|
||||
#[clap(
|
||||
long,
|
||||
help = "Disable the beacon head monitor which tries to attest as soon as any of the \
|
||||
configured beacon nodes sends a head event. Leaving the service enabled is \
|
||||
recommended, but disabling it can lead to reduced bandwidth and more predictable \
|
||||
usage of the primary beacon node (rather than the fastest BN).",
|
||||
display_order = 0,
|
||||
help_heading = FLAG_HEADER
|
||||
)]
|
||||
pub disable_beacon_head_monitor: bool,
|
||||
|
||||
#[clap(
|
||||
long,
|
||||
help = "Disable Lighthouse's slashing protection for all web3signer keys. This can \
|
||||
|
||||
@@ -82,6 +82,8 @@ pub struct Config {
|
||||
pub broadcast_topics: Vec<ApiTopic>,
|
||||
/// Enables a service which attempts to measure latency between the VC and BNs.
|
||||
pub enable_latency_measurement_service: bool,
|
||||
/// Enables the beacon head monitor that reacts to head updates from connected beacon nodes.
|
||||
pub enable_beacon_head_monitor: bool,
|
||||
/// Defines the number of validators per `validator/register_validator` request sent to the BN.
|
||||
pub validator_registration_batch_size: usize,
|
||||
/// Whether we are running with distributed network support.
|
||||
@@ -132,6 +134,7 @@ impl Default for Config {
|
||||
builder_registration_timestamp_override: None,
|
||||
broadcast_topics: vec![ApiTopic::Subscriptions],
|
||||
enable_latency_measurement_service: true,
|
||||
enable_beacon_head_monitor: true,
|
||||
validator_registration_batch_size: 500,
|
||||
distributed: false,
|
||||
initialized_validators: <_>::default(),
|
||||
@@ -377,6 +380,7 @@ impl Config {
|
||||
config.validator_store.builder_boost_factor = validator_client_config.builder_boost_factor;
|
||||
config.enable_latency_measurement_service =
|
||||
!validator_client_config.disable_latency_measurement_service;
|
||||
config.enable_beacon_head_monitor = !validator_client_config.disable_beacon_head_monitor;
|
||||
|
||||
config.validator_registration_batch_size =
|
||||
validator_client_config.validator_registration_batch_size;
|
||||
|
||||
@@ -9,19 +9,21 @@ use metrics::set_gauge;
|
||||
use monitoring_api::{MonitoringHttpClient, ProcessType};
|
||||
use sensitive_url::SensitiveUrl;
|
||||
use slashing_protection::{SLASHING_PROTECTION_FILENAME, SlashingDatabase};
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
use account_utils::validator_definitions::ValidatorDefinitions;
|
||||
use beacon_node_fallback::{
|
||||
BeaconNodeFallback, CandidateBeaconNode, start_fallback_updater_service,
|
||||
BeaconNodeFallback, CandidateBeaconNode, beacon_head_monitor::HeadEvent,
|
||||
start_fallback_updater_service,
|
||||
};
|
||||
use clap::ArgMatches;
|
||||
use doppelganger_service::DoppelgangerService;
|
||||
use environment::RuntimeContext;
|
||||
use eth2::{BeaconNodeHttpClient, StatusCode, Timeouts, reqwest::ClientBuilder};
|
||||
use eth2::{BeaconNodeHttpClient, Timeouts};
|
||||
use initialized_validators::Error::UnableToOpenVotingKeystore;
|
||||
use lighthouse_validator_store::LighthouseValidatorStore;
|
||||
use parking_lot::RwLock;
|
||||
use reqwest::Certificate;
|
||||
use reqwest::{Certificate, ClientBuilder, StatusCode};
|
||||
use slot_clock::SlotClock;
|
||||
use slot_clock::SystemTimeSlotClock;
|
||||
use std::fs::File;
|
||||
@@ -45,6 +47,7 @@ use validator_services::{
|
||||
duties_service::{self, DutiesService, DutiesServiceBuilder},
|
||||
inclusion_list_service::InclusionListService,
|
||||
latency_service,
|
||||
payload_attestation_service::PayloadAttestationService,
|
||||
preparation_service::{PreparationService, PreparationServiceBuilder},
|
||||
sync_committee_service::SyncCommitteeService,
|
||||
};
|
||||
@@ -72,6 +75,8 @@ pub const AGGREGATION_PRE_COMPUTE_EPOCHS: u64 = 2;
|
||||
/// Number of slots in advance to compute sync selection proofs when in `distributed` mode.
|
||||
pub const AGGREGATION_PRE_COMPUTE_SLOTS_DISTRIBUTED: u64 = 1;
|
||||
|
||||
const MAX_HEAD_EVENT_QUEUE_LEN: usize = 1_024;
|
||||
|
||||
type ValidatorStore<E> = LighthouseValidatorStore<SystemTimeSlotClock, E>;
|
||||
|
||||
#[derive(Clone)]
|
||||
@@ -82,6 +87,7 @@ pub struct ProductionValidatorClient<E: EthSpec> {
|
||||
attestation_service: AttestationService<ValidatorStore<E>, SystemTimeSlotClock>,
|
||||
sync_committee_service: SyncCommitteeService<ValidatorStore<E>, SystemTimeSlotClock>,
|
||||
inclusion_list_service: InclusionListService<ValidatorStore<E>, SystemTimeSlotClock>,
|
||||
payload_attestation_service: PayloadAttestationService<ValidatorStore<E>, SystemTimeSlotClock>,
|
||||
doppelganger_service: Option<Arc<DoppelgangerService>>,
|
||||
preparation_service: PreparationService<ValidatorStore<E>, SystemTimeSlotClock>,
|
||||
validator_store: Arc<ValidatorStore<E>>,
|
||||
@@ -186,6 +192,9 @@ impl<E: EthSpec> ProductionValidatorClient<E> {
|
||||
info!(new_validators, "Completed validator discovery");
|
||||
}
|
||||
|
||||
// Check for all validators' fee recipient
|
||||
validator_defs.check_all_fee_recipients(config.validator_store.fee_recipient)?;
|
||||
|
||||
let validators = InitializedValidators::from_definitions(
|
||||
validator_defs,
|
||||
config.validator_dir.clone(),
|
||||
@@ -271,7 +280,7 @@ impl<E: EthSpec> ProductionValidatorClient<E> {
|
||||
let beacon_node_setup = |x: (usize, &SensitiveUrl)| {
|
||||
let i = x.0;
|
||||
let url = x.1;
|
||||
let slot_duration = Duration::from_secs(context.eth2_config.spec.seconds_per_slot);
|
||||
let slot_duration = context.eth2_config.spec.get_slot_duration();
|
||||
|
||||
let mut beacon_node_http_client_builder = ClientBuilder::new();
|
||||
|
||||
@@ -367,11 +376,22 @@ impl<E: EthSpec> ProductionValidatorClient<E> {
|
||||
context.eth2_config.spec.clone(),
|
||||
);
|
||||
|
||||
// Perform some potentially long-running initialization tasks.
|
||||
let (genesis_time, genesis_validators_root) = tokio::select! {
|
||||
tuple = init_from_beacon_node::<E>(&beacon_nodes, &proposer_nodes) => tuple?,
|
||||
() = context.executor.exit() => return Err("Shutting down".to_string())
|
||||
};
|
||||
let (genesis_time, genesis_validators_root) =
|
||||
if let Some(eth2_network_config) = context.eth2_network_config.as_ref() {
|
||||
let time = eth2_network_config
|
||||
.genesis_time::<E>()?
|
||||
.ok_or("no genesis time")?;
|
||||
let root = eth2_network_config
|
||||
.genesis_validators_root::<E>()?
|
||||
.ok_or("no genesis validators root")?;
|
||||
(time, root)
|
||||
} else {
|
||||
// Perform some potentially long-running initialization tasks.
|
||||
tokio::select! {
|
||||
tuple = init_from_beacon_node::<E>(&beacon_nodes, &proposer_nodes) => tuple?,
|
||||
() = context.executor.exit() => return Err("Shutting down".to_string()),
|
||||
}
|
||||
};
|
||||
|
||||
// Update the metrics server.
|
||||
if let Some(ctx) = &validator_metrics_ctx {
|
||||
@@ -381,12 +401,23 @@ impl<E: EthSpec> ProductionValidatorClient<E> {
|
||||
let slot_clock = SystemTimeSlotClock::new(
|
||||
context.eth2_config.spec.genesis_slot,
|
||||
Duration::from_secs(genesis_time),
|
||||
Duration::from_secs(context.eth2_config.spec.seconds_per_slot),
|
||||
context.eth2_config.spec.get_slot_duration(),
|
||||
);
|
||||
|
||||
beacon_nodes.set_slot_clock(slot_clock.clone());
|
||||
proposer_nodes.set_slot_clock(slot_clock.clone());
|
||||
|
||||
// Only the beacon_nodes are used for attestation duties and thus biconditionally
|
||||
// proposer_nodes do not need head_send ref.
|
||||
let head_monitor_rx = if config.enable_beacon_head_monitor {
|
||||
let (head_monitor_tx, head_receiver) =
|
||||
mpsc::channel::<HeadEvent>(MAX_HEAD_EVENT_QUEUE_LEN);
|
||||
beacon_nodes.set_head_send(Arc::new(head_monitor_tx));
|
||||
Some(Mutex::new(head_receiver))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let beacon_nodes = Arc::new(beacon_nodes);
|
||||
start_fallback_updater_service::<_, E>(context.executor.clone(), beacon_nodes.clone())?;
|
||||
|
||||
@@ -497,15 +528,17 @@ impl<E: EthSpec> ProductionValidatorClient<E> {
|
||||
|
||||
let block_service = block_service_builder.build()?;
|
||||
|
||||
let attestation_service = AttestationServiceBuilder::new()
|
||||
let attestation_builder = AttestationServiceBuilder::new()
|
||||
.duties_service(duties_service.clone())
|
||||
.slot_clock(slot_clock.clone())
|
||||
.validator_store(validator_store.clone())
|
||||
.beacon_nodes(beacon_nodes.clone())
|
||||
.executor(context.executor.clone())
|
||||
.head_monitor_rx(head_monitor_rx)
|
||||
.chain_spec(context.eth2_config.spec.clone())
|
||||
.disable(config.disable_attesting)
|
||||
.build()?;
|
||||
.disable(config.disable_attesting);
|
||||
|
||||
let attestation_service = attestation_builder.build()?;
|
||||
|
||||
let preparation_service = PreparationServiceBuilder::new()
|
||||
.slot_clock(slot_clock.clone())
|
||||
@@ -535,6 +568,15 @@ impl<E: EthSpec> ProductionValidatorClient<E> {
|
||||
.disable(false)
|
||||
.build()?;
|
||||
|
||||
let payload_attestation_service = PayloadAttestationService::new(
|
||||
duties_service.clone(),
|
||||
validator_store.clone(),
|
||||
slot_clock.clone(),
|
||||
beacon_nodes.clone(),
|
||||
context.executor.clone(),
|
||||
context.eth2_config.spec.clone(),
|
||||
);
|
||||
|
||||
Ok(Self {
|
||||
context,
|
||||
duties_service,
|
||||
@@ -542,6 +584,7 @@ impl<E: EthSpec> ProductionValidatorClient<E> {
|
||||
attestation_service,
|
||||
sync_committee_service,
|
||||
inclusion_list_service,
|
||||
payload_attestation_service,
|
||||
doppelganger_service,
|
||||
preparation_service,
|
||||
validator_store,
|
||||
@@ -618,6 +661,13 @@ impl<E: EthSpec> ProductionValidatorClient<E> {
|
||||
.start_update_service(&self.context.eth2_config.spec)
|
||||
.map_err(|e| format!("Unable to start inclusion list service: {}", e))?;
|
||||
|
||||
if self.context.eth2_config.spec.is_gloas_scheduled() {
|
||||
self.payload_attestation_service
|
||||
.clone()
|
||||
.start_update_service()
|
||||
.map_err(|e| format!("Unable to start payload attestation service: {}", e))?;
|
||||
}
|
||||
|
||||
self.preparation_service
|
||||
.clone()
|
||||
.start_update_service(&self.context.eth2_config.spec)
|
||||
|
||||
Reference in New Issue
Block a user