mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-23 06:44:35 +00:00
Add comment for clarity
This commit is contained in:
@@ -60,13 +60,13 @@ const WAITING_FOR_GENESIS_POLL_TIME: Duration = Duration::from_secs(12);
|
||||
const HTTP_ATTESTATION_TIMEOUT_QUOTIENT: u32 = 4;
|
||||
const HTTP_ATTESTER_DUTIES_TIMEOUT_QUOTIENT: u32 = 4;
|
||||
const HTTP_ATTESTATION_SUBSCRIPTIONS_TIMEOUT_QUOTIENT: u32 = 24;
|
||||
const HTTP_ATTESTATION_AGGREGATOR_TIMEOUT_QUOTIENT: u32 = 24; // For distributed mode only
|
||||
const HTTP_ATTESTATION_AGGREGATOR_TIMEOUT_QUOTIENT: u32 = 24; // For DVT involving middleware only
|
||||
const HTTP_LIVENESS_TIMEOUT_QUOTIENT: u32 = 4;
|
||||
const HTTP_PROPOSAL_TIMEOUT_QUOTIENT: u32 = 2;
|
||||
const HTTP_PROPOSER_DUTIES_TIMEOUT_QUOTIENT: u32 = 4;
|
||||
const HTTP_SYNC_COMMITTEE_CONTRIBUTION_TIMEOUT_QUOTIENT: u32 = 4;
|
||||
const HTTP_SYNC_DUTIES_TIMEOUT_QUOTIENT: u32 = 4;
|
||||
const HTTP_SYNC_AGGREGATOR_TIMEOUT_QUOTIENT: u32 = 24; // For distributed mode only
|
||||
const HTTP_SYNC_AGGREGATOR_TIMEOUT_QUOTIENT: u32 = 24; // For DVT involving middleware only
|
||||
const HTTP_GET_BEACON_BLOCK_SSZ_TIMEOUT_QUOTIENT: u32 = 4;
|
||||
const HTTP_GET_DEBUG_BEACON_STATE_QUOTIENT: u32 = 4;
|
||||
const HTTP_GET_DEPOSIT_SNAPSHOT_QUOTIENT: u32 = 4;
|
||||
@@ -83,12 +83,12 @@ const SELECTION_PROOF_SLOT_LOOKAHEAD: u64 = 8;
|
||||
/// The attestation selection proof lookahead for those running with the --distributed flag.
|
||||
const SELECTION_PROOF_SLOT_LOOKAHEAD_DVT: u64 = 1;
|
||||
|
||||
/// Fraction of a slot at which selection proof signing should happen (2 means half way).
|
||||
/// Fraction of a slot at which attestation selection proof signing should happen (2 means half way).
|
||||
const SELECTION_PROOF_SCHEDULE_DENOM: u32 = 2;
|
||||
|
||||
/// Number of epochs in advance to compute selection proofs when not in `distributed` mode.
|
||||
/// Number of epochs in advance to compute sync selection proofs when not in `distributed` mode.
|
||||
pub const AGGREGATION_PRE_COMPUTE_EPOCHS: u64 = 2;
|
||||
/// Number of slots in advance to compute selection proofs when in `distributed` mode.
|
||||
/// Number of slots in advance to compute sync selection proofs when in `distributed` mode.
|
||||
pub const AGGREGATION_PRE_COMPUTE_SLOTS_DISTRIBUTED: u64 = 1;
|
||||
|
||||
type ValidatorStore<E> = LighthouseValidatorStore<SystemTimeSlotClock, E>;
|
||||
@@ -499,9 +499,7 @@ impl<E: EthSpec> ProductionValidatorClient<E> {
|
||||
}
|
||||
};
|
||||
|
||||
let duties_service: Arc<
|
||||
DutiesService<LighthouseValidatorStore<SystemTimeSlotClock, E>, SystemTimeSlotClock>,
|
||||
> = Arc::new(
|
||||
let duties_service = Arc::new(
|
||||
DutiesServiceBuilder::new()
|
||||
.slot_clock(slot_clock.clone())
|
||||
.beacon_nodes(beacon_nodes.clone())
|
||||
|
||||
@@ -118,11 +118,12 @@ pub struct SubscriptionSlots {
|
||||
pub struct SelectionProofConfig {
|
||||
pub lookahead_slot: u64,
|
||||
pub computation_offset: Duration, // The seconds to compute the selection proof before a slot
|
||||
pub selections_endpoint: bool,
|
||||
pub parallel_sign: bool,
|
||||
pub selections_endpoint: bool, // whether to call the selections endpoint, true for DVT with middleware
|
||||
pub parallel_sign: bool, // whether to sign the selection proof in parallel, true in distributed mode
|
||||
}
|
||||
|
||||
impl SelectionProofConfig {
|
||||
// Create a default associated function to be passed in DutiesServiceBuilder::new()
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
lookahead_slot: 0,
|
||||
@@ -136,7 +137,7 @@ impl SelectionProofConfig {
|
||||
/// Create a selection proof for `duty`.
|
||||
///
|
||||
/// Return `Ok(None)` if the attesting validator is not an aggregator.
|
||||
async fn make_selection_proof<S: ValidatorStore + 'static, T: SlotClock + 'static>(
|
||||
async fn make_selection_proof<S: ValidatorStore + 'static, T: SlotClock>(
|
||||
duty: &AttesterData,
|
||||
validator_store: &S,
|
||||
spec: &ChainSpec,
|
||||
@@ -147,7 +148,7 @@ async fn make_selection_proof<S: ValidatorStore + 'static, T: SlotClock + 'stati
|
||||
let beacon_committee_selection = BeaconCommitteeSelection {
|
||||
validator_index: duty.validator_index,
|
||||
slot: duty.slot,
|
||||
// In distributed mode, this is partial selection proof
|
||||
// This is partial selection proof
|
||||
selection_proof: validator_store
|
||||
.produce_selection_proof(duty.pubkey, duty.slot)
|
||||
.await
|
||||
@@ -183,6 +184,7 @@ async fn make_selection_proof<S: ValidatorStore + 'static, T: SlotClock + 'stati
|
||||
debug!(
|
||||
"validator_index" = response_data.validator_index,
|
||||
"slot" = %response_data.slot,
|
||||
// The selection proof from middleware response will be a full selection proof
|
||||
"full selection proof" = ?response_data.selection_proof,
|
||||
"Received selection from middleware"
|
||||
);
|
||||
@@ -277,8 +279,9 @@ pub struct DutiesServiceBuilder<S, T> {
|
||||
spec: Option<Arc<ChainSpec>>,
|
||||
//// Whether we permit large validator counts in the metrics.
|
||||
enable_high_validator_count_metrics: bool,
|
||||
/// If this validator is running in distributed mode.
|
||||
/// Create attestation selection proof config
|
||||
attestation_selection_proof_config: SelectionProofConfig,
|
||||
/// Create sync selection proof config
|
||||
sync_selection_proof_config: SelectionProofConfig,
|
||||
disable_attesting: bool,
|
||||
}
|
||||
|
||||
@@ -487,7 +487,7 @@ pub async fn poll_sync_committee_duties_for_period<S: ValidatorStore, T: SlotClo
|
||||
}
|
||||
|
||||
// Create a helper function here to reduce code duplication for normal and distributed mode
|
||||
pub async fn make_sync_selection_proof<S: ValidatorStore, T: SlotClock + 'static>(
|
||||
pub async fn make_sync_selection_proof<S: ValidatorStore, T: SlotClock>(
|
||||
duties_service: &Arc<DutiesService<S, T>>,
|
||||
duty: &SyncDuty,
|
||||
proof_slot: Slot,
|
||||
@@ -519,7 +519,7 @@ pub async fn make_sync_selection_proof<S: ValidatorStore, T: SlotClock + 'static
|
||||
}
|
||||
};
|
||||
|
||||
// In distributed mode when we want to call the selections endpoint
|
||||
// In DVT with middleware, when we want to call the selections endpoint
|
||||
if duties_service
|
||||
.sync_duties
|
||||
.selection_proof_config
|
||||
@@ -529,7 +529,7 @@ pub async fn make_sync_selection_proof<S: ValidatorStore, T: SlotClock + 'static
|
||||
"validator_index" = duty.validator_index,
|
||||
"slot" = %proof_slot,
|
||||
"subcommittee_index" = *subnet_id,
|
||||
// In distributed mode, this is partial selection proof
|
||||
// This is partial selection proof
|
||||
"partial selection proof" = ?Signature::from(selection_proof.clone()),
|
||||
"Sending sync selection to middleware"
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user