Merge remote-tracking branch 'origin/release-v7.0.0' into unstable

This commit is contained in:
Michael Sproul
2025-03-10 15:21:24 +11:00
19 changed files with 154 additions and 36 deletions

View File

@@ -97,6 +97,15 @@ pub struct ValidatorClient {
)]
pub disable_auto_discover: bool,
#[clap(
long,
help = "Disable the performance of attestation duties (and sync committee duties). This \
flag should only be used in emergencies to prioritise block proposal duties.",
display_order = 0,
help_heading = FLAG_HEADER
)]
pub disable_attesting: bool,
#[clap(
long,
help = "If present, the validator client will use longer timeouts for requests \
@@ -107,6 +116,20 @@ pub struct ValidatorClient {
)]
pub use_long_timeouts: bool,
#[clap(
long,
requires = "use_long_timeouts",
default_value_t = 1,
help = "If present, the validator client will use a multiplier for the timeout \
when making requests to the beacon node. This only takes effect when \
the `--use-long-timeouts` flag is present. The timeouts will be the slot \
duration multiplied by this value. This flag is generally not recommended, \
longer timeouts can cause missed duties when fallbacks are used.",
display_order = 0,
help_heading = FLAG_HEADER,
)]
pub long_timeouts_multiplier: u32,
#[clap(
long,
value_name = "CERTIFICATE-FILES",

View File

@@ -49,6 +49,8 @@ pub struct Config {
pub init_slashing_protection: bool,
/// If true, use longer timeouts for requests made to the beacon node.
pub use_long_timeouts: bool,
/// Multiplier to use for long timeouts.
pub long_timeouts_multiplier: u32,
/// Graffiti to be inserted everytime we create a block.
pub graffiti: Option<Graffiti>,
/// Graffiti file to load per validator graffitis.
@@ -85,6 +87,7 @@ pub struct Config {
/// Configuration for the initialized validators
#[serde(flatten)]
pub initialized_validators: InitializedValidatorsConfig,
pub disable_attesting: bool,
}
impl Default for Config {
@@ -111,6 +114,7 @@ impl Default for Config {
disable_auto_discover: false,
init_slashing_protection: false,
use_long_timeouts: false,
long_timeouts_multiplier: 1,
graffiti: None,
graffiti_file: None,
http_api: <_>::default(),
@@ -126,6 +130,7 @@ impl Default for Config {
validator_registration_batch_size: 500,
distributed: false,
initialized_validators: <_>::default(),
disable_attesting: false,
}
}
}
@@ -194,6 +199,7 @@ impl Config {
config.disable_auto_discover = validator_client_config.disable_auto_discover;
config.init_slashing_protection = validator_client_config.init_slashing_protection;
config.use_long_timeouts = validator_client_config.use_long_timeouts;
config.long_timeouts_multiplier = validator_client_config.long_timeouts_multiplier;
if let Some(graffiti_file_path) = validator_client_config.graffiti_file.as_ref() {
let mut graffiti_file = GraffitiFile::new(graffiti_file_path.into());
@@ -379,6 +385,8 @@ impl Config {
true
};
config.disable_attesting = validator_client_config.disable_attesting;
Ok(config)
}
}

View File

@@ -325,7 +325,7 @@ impl<E: EthSpec> ProductionValidatorClient<E> {
get_validator_block: slot_duration / HTTP_GET_VALIDATOR_BLOCK_TIMEOUT_QUOTIENT,
}
} else {
Timeouts::set_all(slot_duration)
Timeouts::set_all(slot_duration.saturating_mul(config.long_timeouts_multiplier))
};
Ok(BeaconNodeHttpClient::from_components(
@@ -478,6 +478,7 @@ impl<E: EthSpec> ProductionValidatorClient<E> {
context: duties_context,
enable_high_validator_count_metrics: config.enable_high_validator_count_metrics,
distributed: config.distributed,
disable_attesting: config.disable_attesting,
});
// Update the metrics server.
@@ -507,6 +508,7 @@ impl<E: EthSpec> ProductionValidatorClient<E> {
.validator_store(validator_store.clone())
.beacon_nodes(beacon_nodes.clone())
.runtime_context(context.service_context("attestation".into()))
.disable(config.disable_attesting)
.build()?;
let preparation_service = PreparationServiceBuilder::new()

View File

@@ -21,6 +21,7 @@ pub struct AttestationServiceBuilder<T: SlotClock + 'static, E: EthSpec> {
slot_clock: Option<T>,
beacon_nodes: Option<Arc<BeaconNodeFallback<T, E>>>,
context: Option<RuntimeContext<E>>,
disable: bool,
}
impl<T: SlotClock + 'static, E: EthSpec> AttestationServiceBuilder<T, E> {
@@ -31,6 +32,7 @@ impl<T: SlotClock + 'static, E: EthSpec> AttestationServiceBuilder<T, E> {
slot_clock: None,
beacon_nodes: None,
context: None,
disable: false,
}
}
@@ -59,6 +61,11 @@ impl<T: SlotClock + 'static, E: EthSpec> AttestationServiceBuilder<T, E> {
self
}
pub fn disable(mut self, disable: bool) -> Self {
self.disable = disable;
self
}
pub fn build(self) -> Result<AttestationService<T, E>, String> {
Ok(AttestationService {
inner: Arc::new(Inner {
@@ -77,6 +84,7 @@ impl<T: SlotClock + 'static, E: EthSpec> AttestationServiceBuilder<T, E> {
context: self
.context
.ok_or("Cannot build AttestationService without runtime_context")?,
disable: self.disable,
}),
})
}
@@ -89,6 +97,7 @@ pub struct Inner<T, E: EthSpec> {
slot_clock: T,
beacon_nodes: Arc<BeaconNodeFallback<T, E>>,
context: RuntimeContext<E>,
disable: bool,
}
/// Attempts to produce attestations for all known validators 1/3rd of the way through each slot.
@@ -120,6 +129,10 @@ impl<T: SlotClock + 'static, E: EthSpec> AttestationService<T, E> {
/// Starts the service which periodically produces attestations.
pub fn start_update_service(self, spec: &ChainSpec) -> Result<(), String> {
let log = self.context.log().clone();
if self.disable {
info!(log, "Attestation service disabled");
return Ok(());
}
let slot_duration = Duration::from_secs(spec.seconds_per_slot);
let duration_to_next_slot = self

View File

@@ -230,6 +230,7 @@ pub struct DutiesService<T, E: EthSpec> {
pub enable_high_validator_count_metrics: bool,
/// If this validator is running in distributed mode.
pub distributed: bool,
pub disable_attesting: bool,
}
impl<T: SlotClock + 'static, E: EthSpec> DutiesService<T, E> {
@@ -403,6 +404,11 @@ pub fn start_update_service<T: SlotClock + 'static, E: EthSpec>(
"duties_service_proposers",
);
// Skip starting attestation duties or sync committee services.
if core_duties_service.disable_attesting {
return;
}
/*
* Spawn the task which keeps track of local attestation duties.
*/

View File

@@ -87,6 +87,11 @@ impl<T: SlotClock + 'static, E: EthSpec> SyncCommitteeService<T, E> {
pub fn start_update_service(self, spec: &ChainSpec) -> Result<(), String> {
let log = self.context.log().clone();
if self.duties_service.disable_attesting {
info!(log, "Sync committee service disabled");
return Ok(());
}
let slot_duration = Duration::from_secs(spec.seconds_per_slot);
let duration_to_next_slot = self
.slot_clock