mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 00:42:42 +00:00
refactor for normal mode
This commit is contained in:
@@ -651,11 +651,10 @@ pub async fn fill_in_aggregation_proofs<T: SlotClock + 'static, E: EthSpec>(
|
|||||||
// Store all partial sync selection proofs so that it can be sent together later
|
// Store all partial sync selection proofs so that it can be sent together later
|
||||||
for &subnet_id in &subnet_ids {
|
for &subnet_id in &subnet_ids {
|
||||||
let duties_service = duties_service.clone();
|
let duties_service = duties_service.clone();
|
||||||
let duty = duty.clone();
|
|
||||||
futures_unordered.push(async move {
|
futures_unordered.push(async move {
|
||||||
let result = make_sync_selection_proof(
|
let result = make_sync_selection_proof(
|
||||||
&duties_service,
|
&duties_service,
|
||||||
&duty,
|
duty,
|
||||||
proof_slot,
|
proof_slot,
|
||||||
subnet_id,
|
subnet_id,
|
||||||
config_ref,
|
config_ref,
|
||||||
@@ -748,58 +747,45 @@ pub async fn fill_in_aggregation_proofs<T: SlotClock + 'static, E: EthSpec>(
|
|||||||
|
|
||||||
// Create futures to produce proofs.
|
// Create futures to produce proofs.
|
||||||
let duties_service_ref = &duties_service;
|
let duties_service_ref = &duties_service;
|
||||||
|
let config_ref = &config;
|
||||||
let futures = subnet_ids.iter().map(|subnet_id| async move {
|
let futures = subnet_ids.iter().map(|subnet_id| async move {
|
||||||
// Construct proof for prior slot.
|
// Construct proof for prior slot.
|
||||||
let proof_slot = slot - 1;
|
let proof_slot = slot - 1;
|
||||||
|
|
||||||
let proof = match duties_service_ref
|
let proof = make_sync_selection_proof(
|
||||||
.validator_store
|
duties_service_ref,
|
||||||
.produce_sync_selection_proof(&duty.pubkey, proof_slot, *subnet_id)
|
duty,
|
||||||
.await
|
proof_slot,
|
||||||
{
|
*subnet_id,
|
||||||
Ok(proof) => proof,
|
config_ref,
|
||||||
Err(ValidatorStoreError::UnknownPubkey(pubkey)) => {
|
&duties_service_ref.beacon_nodes,
|
||||||
// A pubkey can be missing when a validator was recently
|
)
|
||||||
// removed via the API.
|
.await;
|
||||||
debug!(
|
|
||||||
?pubkey,
|
|
||||||
pubkey = ?duty.pubkey,
|
|
||||||
slot = %proof_slot,
|
|
||||||
"Missing pubkey for sync selection proof"
|
|
||||||
);
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
Err(e) => {
|
|
||||||
warn!(
|
|
||||||
error = ?e,
|
|
||||||
pubkey = ?duty.pubkey,
|
|
||||||
slot = %proof_slot,
|
|
||||||
"Unable to sign selection proof"
|
|
||||||
);
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
match proof.is_aggregator::<E>() {
|
match proof {
|
||||||
Ok(true) => {
|
Some(proof) => match proof.is_aggregator::<E>() {
|
||||||
debug!(
|
Ok(true) => {
|
||||||
validator_index = duty.validator_index,
|
debug!(
|
||||||
slot = %proof_slot,
|
validator_index = duty.validator_index,
|
||||||
%subnet_id,
|
slot = %proof_slot,
|
||||||
"Validator is sync aggregator"
|
%subnet_id,
|
||||||
);
|
"Validator is sync aggregator"
|
||||||
Some(((proof_slot, *subnet_id), proof))
|
);
|
||||||
}
|
Some(((proof_slot, *subnet_id), proof))
|
||||||
Ok(false) => None,
|
}
|
||||||
Err(e) => {
|
Ok(false) => None,
|
||||||
warn!(
|
Err(e) => {
|
||||||
pubkey = ?duty.pubkey,
|
warn!(
|
||||||
slot = %proof_slot,
|
pubkey = ?duty.pubkey,
|
||||||
error = ?e,
|
slot = %proof_slot,
|
||||||
"Error determining is_aggregator"
|
error = ?e,
|
||||||
);
|
"Error determining is_aggregator"
|
||||||
None
|
);
|
||||||
}
|
None
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
None => None,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user