merge conflicts

This commit is contained in:
Eitan Seri-Levi
2026-04-27 22:47:19 +02:00
parent d2ec1cda51
commit 9debb1a30b
6 changed files with 1 additions and 255 deletions

View File

@@ -45,11 +45,7 @@ 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,
};
@@ -557,17 +553,6 @@ impl<E: EthSpec> ProductionValidatorClient<E> {
beacon_nodes.clone(),
context.executor.clone(),
);
<<<<<<< HEAD
let payload_attestation_service = PayloadAttestationServiceBuilder::new()
.duties_service(duties_service.clone())
.validator_store(validator_store.clone())
.slot_clock(slot_clock.clone())
.beacon_nodes(beacon_nodes.clone())
.executor(context.executor.clone())
.chain_spec(context.eth2_config.spec.clone())
.build()?;
=======
let payload_attestation_service = PayloadAttestationService::new(
duties_service.clone(),
validator_store.clone(),
@@ -576,7 +561,6 @@ impl<E: EthSpec> ProductionValidatorClient<E> {
context.executor.clone(),
context.eth2_config.spec.clone(),
);
>>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12
Ok(Self {
context,
@@ -656,19 +640,12 @@ 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()

View File

@@ -7,100 +7,9 @@ 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;
pub struct PayloadAttestationServiceBuilder<S: ValidatorStore, T: SlotClock + 'static> {
duties_service: Option<Arc<DutiesService<S, T>>>,
validator_store: Option<Arc<S>>,
slot_clock: Option<T>,
beacon_nodes: Option<Arc<BeaconNodeFallback<T>>>,
executor: Option<TaskExecutor>,
chain_spec: Option<Arc<ChainSpec>>,
}
impl<S: ValidatorStore + 'static, T: SlotClock + 'static> Default
for PayloadAttestationServiceBuilder<S, T>
{
fn default() -> Self {
Self::new()
}
}
impl<S: ValidatorStore + 'static, T: SlotClock + 'static> PayloadAttestationServiceBuilder<S, T> {
pub fn new() -> Self {
Self {
duties_service: None,
validator_store: None,
slot_clock: None,
beacon_nodes: None,
executor: None,
chain_spec: None,
}
}
pub fn duties_service(mut self, service: Arc<DutiesService<S, T>>) -> Self {
self.duties_service = Some(service);
self
}
pub fn validator_store(mut self, store: Arc<S>) -> Self {
self.validator_store = Some(store);
self
}
pub fn slot_clock(mut self, slot_clock: T) -> Self {
self.slot_clock = Some(slot_clock);
self
}
pub fn beacon_nodes(mut self, beacon_nodes: Arc<BeaconNodeFallback<T>>) -> Self {
self.beacon_nodes = Some(beacon_nodes);
self
}
pub fn executor(mut self, executor: TaskExecutor) -> Self {
self.executor = Some(executor);
self
}
pub fn chain_spec(mut self, chain_spec: Arc<ChainSpec>) -> Self {
self.chain_spec = Some(chain_spec);
self
}
pub fn build(self) -> Result<PayloadAttestationService<S, T>, String> {
Ok(PayloadAttestationService {
inner: Arc::new(Inner {
duties_service: self
.duties_service
.ok_or("Cannot build PayloadAttestationService without duties_service")?,
validator_store: self
.validator_store
.ok_or("Cannot build PayloadAttestationService without validator_store")?,
slot_clock: self
.slot_clock
.ok_or("Cannot build PayloadAttestationService without slot_clock")?,
beacon_nodes: self
.beacon_nodes
.ok_or("Cannot build PayloadAttestationService without beacon_nodes")?,
executor: self
.executor
.ok_or("Cannot build PayloadAttestationService without executor")?,
chain_spec: self
.chain_spec
.ok_or("Cannot build PayloadAttestationService without chain_spec")?,
}),
})
}
}
=======
use types::{ChainSpec, EthSpec};
use validator_store::ValidatorStore;
>>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12
pub struct Inner<S, T> {
duties_service: Arc<DutiesService<S, T>>,
validator_store: Arc<S>,
@@ -131,8 +40,6 @@ 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>,
@@ -153,7 +60,6 @@ impl<S: ValidatorStore + 'static, T: SlotClock + 'static> PayloadAttestationServ
}
}
>>>>>>> 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();
@@ -173,11 +79,6 @@ 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;
@@ -188,21 +89,6 @@ impl<S: ValidatorStore + 'static, T: SlotClock + 'static> PayloadAttestationServ
.fork_name_at_slot::<S::E>(current_slot)
.gloas_enabled()
{
<<<<<<< HEAD
continue;
}
let duties = self.duties_service.get_ptc_duties_for_slot(current_slot);
if duties.is_empty() {
continue;
}
debug!(
%current_slot,
duty_count = duties.len(),
"Producing payload attestations"
);
=======
let duration_to_next_epoch = self
.slot_clock
.duration_to_next_epoch(S::E::slots_per_epoch())
@@ -214,7 +100,6 @@ impl<S: ValidatorStore + 'static, T: SlotClock + 'static> PayloadAttestationServ
}
sleep(duration_to_next_slot + payload_attestation_due).await;
>>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12
let service = self.clone();
self.executor.spawn(
@@ -232,23 +117,17 @@ 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 {
@@ -305,21 +184,15 @@ 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:?}"))
}
@@ -335,11 +208,7 @@ 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:?}")