mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-10 01:26:44 +00:00
merge conflicts
This commit is contained in:
@@ -45,7 +45,11 @@ use validator_services::{
|
||||
block_service::{BlockService, BlockServiceBuilder},
|
||||
duties_service::{self, DutiesService, DutiesServiceBuilder},
|
||||
latency_service,
|
||||
<<<<<<< HEAD
|
||||
payload_attestation_service::{PayloadAttestationService, PayloadAttestationServiceBuilder},
|
||||
=======
|
||||
payload_attestation_service::PayloadAttestationService,
|
||||
>>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12
|
||||
preparation_service::{PreparationService, PreparationServiceBuilder},
|
||||
sync_committee_service::SyncCommitteeService,
|
||||
};
|
||||
@@ -554,6 +558,7 @@ impl<E: EthSpec> ProductionValidatorClient<E> {
|
||||
context.executor.clone(),
|
||||
);
|
||||
|
||||
<<<<<<< HEAD
|
||||
let payload_attestation_service = PayloadAttestationServiceBuilder::new()
|
||||
.duties_service(duties_service.clone())
|
||||
.validator_store(validator_store.clone())
|
||||
@@ -562,6 +567,16 @@ impl<E: EthSpec> ProductionValidatorClient<E> {
|
||||
.executor(context.executor.clone())
|
||||
.chain_spec(context.eth2_config.spec.clone())
|
||||
.build()?;
|
||||
=======
|
||||
let payload_attestation_service = PayloadAttestationService::new(
|
||||
duties_service.clone(),
|
||||
validator_store.clone(),
|
||||
slot_clock.clone(),
|
||||
beacon_nodes.clone(),
|
||||
context.executor.clone(),
|
||||
context.eth2_config.spec.clone(),
|
||||
);
|
||||
>>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12
|
||||
|
||||
Ok(Self {
|
||||
context,
|
||||
@@ -641,10 +656,19 @@ impl<E: EthSpec> ProductionValidatorClient<E> {
|
||||
.start_update_service(&self.context.eth2_config.spec)
|
||||
.map_err(|e| format!("Unable to start sync committee service: {}", e))?;
|
||||
|
||||
<<<<<<< HEAD
|
||||
self.payload_attestation_service
|
||||
.clone()
|
||||
.start_update_service()
|
||||
.map_err(|e| format!("Unable to start payload attestation service: {}", e))?;
|
||||
=======
|
||||
if self.context.eth2_config.spec.is_gloas_scheduled() {
|
||||
self.payload_attestation_service
|
||||
.clone()
|
||||
.start_update_service()
|
||||
.map_err(|e| format!("Unable to start payload attestation service: {}", e))?;
|
||||
}
|
||||
>>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12
|
||||
|
||||
self.preparation_service
|
||||
.clone()
|
||||
|
||||
@@ -7,6 +7,7 @@ use std::sync::Arc;
|
||||
use task_executor::TaskExecutor;
|
||||
use tokio::time::sleep;
|
||||
use tracing::{debug, error, info};
|
||||
<<<<<<< HEAD
|
||||
use types::ChainSpec;
|
||||
use validator_store::ValidatorStore;
|
||||
|
||||
@@ -95,6 +96,11 @@ impl<S: ValidatorStore + 'static, T: SlotClock + 'static> PayloadAttestationServ
|
||||
}
|
||||
}
|
||||
|
||||
=======
|
||||
use types::{ChainSpec, EthSpec};
|
||||
use validator_store::ValidatorStore;
|
||||
|
||||
>>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12
|
||||
pub struct Inner<S, T> {
|
||||
duties_service: Arc<DutiesService<S, T>>,
|
||||
validator_store: Arc<S>,
|
||||
@@ -125,6 +131,29 @@ impl<S, T> Deref for PayloadAttestationService<S, T> {
|
||||
}
|
||||
|
||||
impl<S: ValidatorStore + 'static, T: SlotClock + 'static> PayloadAttestationService<S, T> {
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
pub fn new(
|
||||
duties_service: Arc<DutiesService<S, T>>,
|
||||
validator_store: Arc<S>,
|
||||
slot_clock: T,
|
||||
beacon_nodes: Arc<BeaconNodeFallback<T>>,
|
||||
executor: TaskExecutor,
|
||||
chain_spec: Arc<ChainSpec>,
|
||||
) -> Self {
|
||||
Self {
|
||||
inner: Arc::new(Inner {
|
||||
duties_service,
|
||||
validator_store,
|
||||
slot_clock,
|
||||
beacon_nodes,
|
||||
executor,
|
||||
chain_spec,
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
>>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12
|
||||
pub fn start_update_service(self) -> Result<(), String> {
|
||||
let slot_duration = self.chain_spec.get_slot_duration();
|
||||
let payload_attestation_due = self.chain_spec.get_payload_attestation_due();
|
||||
@@ -144,8 +173,11 @@ impl<S: ValidatorStore + 'static, T: SlotClock + 'static> PayloadAttestationServ
|
||||
continue;
|
||||
};
|
||||
|
||||
<<<<<<< HEAD
|
||||
sleep(duration_to_next_slot + payload_attestation_due).await;
|
||||
|
||||
=======
|
||||
>>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12
|
||||
let Some(current_slot) = self.slot_clock.now() else {
|
||||
error!("Failed to read slot clock after trigger");
|
||||
continue;
|
||||
@@ -156,6 +188,7 @@ impl<S: ValidatorStore + 'static, T: SlotClock + 'static> PayloadAttestationServ
|
||||
.fork_name_at_slot::<S::E>(current_slot)
|
||||
.gloas_enabled()
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -169,6 +202,19 @@ impl<S: ValidatorStore + 'static, T: SlotClock + 'static> PayloadAttestationServ
|
||||
duty_count = duties.len(),
|
||||
"Producing payload attestations"
|
||||
);
|
||||
=======
|
||||
let duration_to_next_epoch = self
|
||||
.slot_clock
|
||||
.duration_to_next_epoch(S::E::slots_per_epoch())
|
||||
.unwrap_or_else(|| {
|
||||
self.chain_spec.get_slot_duration() * S::E::slots_per_epoch() as u32
|
||||
});
|
||||
sleep(duration_to_next_epoch).await;
|
||||
continue;
|
||||
}
|
||||
|
||||
sleep(duration_to_next_slot + payload_attestation_due).await;
|
||||
>>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12
|
||||
|
||||
let service = self.clone();
|
||||
self.executor.spawn(
|
||||
@@ -186,10 +232,23 @@ impl<S: ValidatorStore + 'static, T: SlotClock + 'static> PayloadAttestationServ
|
||||
|
||||
async fn produce_and_publish(&self, slot: types::Slot) {
|
||||
let duties = self.duties_service.get_ptc_duties_for_slot(slot);
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
>>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12
|
||||
if duties.is_empty() {
|
||||
return;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
debug!(
|
||||
%slot,
|
||||
duty_count = duties.len(),
|
||||
"Producing payload attestations"
|
||||
);
|
||||
|
||||
>>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12
|
||||
let attestation_data = match self
|
||||
.beacon_nodes
|
||||
.first_success(|beacon_node| async move {
|
||||
@@ -246,13 +305,21 @@ impl<S: ValidatorStore + 'static, T: SlotClock + 'static> PayloadAttestationServ
|
||||
}
|
||||
|
||||
let count = messages.len();
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
let fork_name = self.chain_spec.fork_name_at_slot::<S::E>(slot);
|
||||
>>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12
|
||||
let result = self
|
||||
.beacon_nodes
|
||||
.first_success(|beacon_node| {
|
||||
let messages = messages.clone();
|
||||
async move {
|
||||
beacon_node
|
||||
<<<<<<< HEAD
|
||||
.post_beacon_pool_payload_attestations_ssz(&messages)
|
||||
=======
|
||||
.post_beacon_pool_payload_attestations_ssz(&messages, fork_name)
|
||||
>>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12
|
||||
.await
|
||||
.map_err(|e| format!("Failed to publish payload attestations (SSZ): {e:?}"))
|
||||
}
|
||||
@@ -268,7 +335,11 @@ impl<S: ValidatorStore + 'static, T: SlotClock + 'static> PayloadAttestationServ
|
||||
let messages = messages.clone();
|
||||
async move {
|
||||
beacon_node
|
||||
<<<<<<< HEAD
|
||||
.post_beacon_pool_payload_attestations(&messages)
|
||||
=======
|
||||
.post_beacon_pool_payload_attestations(&messages, fork_name)
|
||||
>>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12
|
||||
.await
|
||||
.map_err(|e| {
|
||||
format!("Failed to publish payload attestations (JSON): {e:?}")
|
||||
|
||||
Reference in New Issue
Block a user