mirror of
https://github.com/sigp/lighthouse.git
synced 2026-07-02 04:14:33 +00:00
Fix race condition between validator duties service and proposer preferences (#9309)
The proposer preferences service was attempting to publish preferences at the start of each epoch. This caused it to race with the validator duties service, it wouldn't calculate validator duties in time for the proposer preference service. This PR first updates the validator duties service to calculate proposer duties for the current epoch and the next epoch. After Fulu we have the ability to look ahead one epoch for proposer duties, but we never updated the vc to leverage this feature. This PR also updates the proposer preferences service to fire at every slot. We have an `(Epoch, DependentRoot)` map that prevents us from publishing the same preferences twice. The changes here should prevent the race condition between the two services and make the proposer preferences service more robust in general. Co-Authored-By: Eitan Seri- Levi <eserilev@gmail.com> Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu> Co-Authored-By: Michael Sproul <michaelsproul@users.noreply.github.com>
This commit is contained in:
@@ -105,6 +105,17 @@ pub struct ValidatorClient {
|
||||
)]
|
||||
pub disable_attesting: bool,
|
||||
|
||||
#[clap(
|
||||
long,
|
||||
help = "Fetch proposer duties using the v1 beacon node endpoint instead of v2. The v1 \
|
||||
endpoint reports an incorrect dependent root which causes spurious proposer duty \
|
||||
re-org warnings. Only enable this flag if your beacon node does not serve the v2 \
|
||||
proposer duties endpoint.",
|
||||
display_order = 0,
|
||||
help_heading = FLAG_HEADER
|
||||
)]
|
||||
pub disable_proposer_duties_v2: bool,
|
||||
|
||||
#[clap(
|
||||
long,
|
||||
help = "If present, the validator client will use longer timeouts for requests \
|
||||
|
||||
@@ -92,6 +92,8 @@ pub struct Config {
|
||||
#[serde(flatten)]
|
||||
pub initialized_validators: InitializedValidatorsConfig,
|
||||
pub disable_attesting: bool,
|
||||
/// Fetch proposer duties using the v1 endpoint instead of v2.
|
||||
pub disable_proposer_duties_v2: bool,
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
@@ -139,6 +141,7 @@ impl Default for Config {
|
||||
distributed: false,
|
||||
initialized_validators: <_>::default(),
|
||||
disable_attesting: false,
|
||||
disable_proposer_duties_v2: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -402,6 +405,7 @@ impl Config {
|
||||
};
|
||||
|
||||
config.disable_attesting = validator_client_config.disable_attesting;
|
||||
config.disable_proposer_duties_v2 = validator_client_config.disable_proposer_duties_v2;
|
||||
|
||||
Ok(config)
|
||||
}
|
||||
|
||||
@@ -502,6 +502,7 @@ impl<E: EthSpec> ProductionValidatorClient<E> {
|
||||
.attestation_selection_proof_config(attestation_selection_proof_config)
|
||||
.sync_selection_proof_config(sync_selection_proof_config)
|
||||
.disable_attesting(config.disable_attesting)
|
||||
.disable_proposer_duties_v2(config.disable_proposer_duties_v2)
|
||||
.build()?,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user