Revise a bit

This commit is contained in:
Tan Chee Keong
2025-02-20 09:53:15 +08:00
parent 358646cf9b
commit 83db29a0da

View File

@@ -134,9 +134,7 @@ async fn make_selection_proof<T: SlotClock + 'static, E: EthSpec>(
beacon_nodes: &Arc<BeaconNodeFallback<T, E>>, beacon_nodes: &Arc<BeaconNodeFallback<T, E>>,
) -> Result<Option<SelectionProof>, Error> { ) -> Result<Option<SelectionProof>, Error> {
let selection_proof = if distributed { let selection_proof = if distributed {
// Call the endpoint /eth/v1/validator/beacon_committee_selections // Submit a partial selection proof in the data field of the POST HTTP endpoint
// During the call, we submit a partial selection proof in the data field of the POST HTTP endpoint
// The end point (middleware) should return a full selection proof
let selections = BeaconCommitteeSelection { let selections = BeaconCommitteeSelection {
validator_index: duty.validator_index, validator_index: duty.validator_index,
slot: duty.slot, slot: duty.slot,
@@ -146,6 +144,8 @@ async fn make_selection_proof<T: SlotClock + 'static, E: EthSpec>(
.map_err(Error::FailedToProduceSelectionProof)? .map_err(Error::FailedToProduceSelectionProof)?
.into(), .into(),
}; };
// Call the endpoint /eth/v1/validator/beacon_committee_selections
// The middleware should return a full selection proof here
beacon_nodes beacon_nodes
.first_success(|beacon_node| async move { .first_success(|beacon_node| async move {
beacon_node beacon_node
@@ -153,12 +153,12 @@ async fn make_selection_proof<T: SlotClock + 'static, E: EthSpec>(
.await .await
}) })
.await .await
.map_err(|e| Error::FailedToDownloadAttesters(e.to_string()))? .map_err(Error::FailedToProduceSelectionProof)?
} else { } else {
validator_store validator_store
.produce_selection_proof(duty.pubkey, duty.slot) .produce_selection_proof(duty.pubkey, duty.slot)
.await .await
.map_err(Error::FailedToProduceSelectionProof)?; .map_err(Error::FailedToProduceSelectionProof)?
}; };
selection_proof selection_proof