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

@@ -7,10 +7,7 @@ use genesis::{generate_deterministic_keypairs, interop_genesis_state};
use parking_lot::RwLock;
use proto_array::PayloadStatus;
use slot_clock::{SlotClock, TestingSlotClock};
<<<<<<< HEAD
=======
use state_processing::AllCaches;
>>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12
use state_processing::genesis::genesis_block;
use store::{HotColdDB, StoreConfig};
use types::{
@@ -29,11 +26,7 @@ use crate::{
GossipVerificationContext, VerifiedPayloadAttestationMessage,
},
},
<<<<<<< HEAD
test_utils::{EphemeralHarnessType, fork_name_from_env, test_spec},
=======
test_utils::{BeaconChainHarness, EphemeralHarnessType, fork_name_from_env, test_spec},
>>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12
validator_pubkey_cache::ValidatorPubkeyCache,
};
@@ -334,8 +327,6 @@ fn duplicate_after_valid() {
Err(PayloadAttestationError::PriorPayloadAttestationMessageKnown { .. })
));
}
<<<<<<< HEAD
=======
/// Exercises the `partial_state_advance` fallback in gossip verification when
/// the head state is too stale to compute PTC membership (e.g., during a
@@ -429,4 +420,3 @@ async fn stale_head_with_partial_advance() {
result.unwrap_err()
);
}
>>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12

View File

@@ -543,20 +543,12 @@ pub fn post_beacon_pool_payload_attestations<T: BeaconChainTypes>(
.and(network_tx_filter.clone())
.then(
|task_spawner: TaskSpawner<T::EthSpec>,
<<<<<<< HEAD
_chain: Arc<BeaconChain<T>>,
=======
chain: Arc<BeaconChain<T>>,
>>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12
messages: Vec<PayloadAttestationMessage>,
_fork_name: Option<ForkName>,
network_tx: UnboundedSender<NetworkMessage<T::EthSpec>>| {
task_spawner.blocking_json_task(Priority::P0, move || {
<<<<<<< HEAD
publish_payload_attestation_messages(&network_tx, messages)
=======
publish_payload_attestation_messages(&chain, &network_tx, messages)
>>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12
})
},
)
@@ -582,11 +574,7 @@ pub fn post_beacon_pool_payload_attestations_ssz<T: BeaconChainTypes>(
.then(
|body_bytes: Bytes,
task_spawner: TaskSpawner<T::EthSpec>,
<<<<<<< HEAD
_chain: Arc<BeaconChain<T>>,
=======
chain: Arc<BeaconChain<T>>,
>>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12
network_tx: UnboundedSender<NetworkMessage<T::EthSpec>>| {
task_spawner.blocking_json_task(Priority::P0, move || {
let item_len = <PayloadAttestationMessage as Encode>::ssz_fixed_len();
@@ -608,31 +596,13 @@ pub fn post_beacon_pool_payload_attestations_ssz<T: BeaconChainTypes>(
})
.collect::<Result<_, _>>()?;
<<<<<<< HEAD
publish_payload_attestation_messages(&network_tx, messages)
=======
publish_payload_attestation_messages(&chain, &network_tx, messages)
>>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12
})
},
)
.boxed()
}
<<<<<<< HEAD
fn publish_payload_attestation_messages<E: types::EthSpec>(
network_tx: &UnboundedSender<NetworkMessage<E>>,
messages: Vec<PayloadAttestationMessage>,
) -> Result<(), warp::Rejection> {
// TODO(gloas): add proper gossip verification and store in ptc op pool.
for message in messages {
utils::publish_pubsub_message(
network_tx,
PubsubMessage::PayloadAttestation(Box::new(message)),
)?;
}
Ok(())
=======
fn publish_payload_attestation_messages<T: BeaconChainTypes>(
chain: &BeaconChain<T>,
network_tx: &UnboundedSender<NetworkMessage<T::EthSpec>>,
@@ -690,5 +660,4 @@ fn publish_payload_attestation_messages<T: BeaconChainTypes>(
failures,
))
}
>>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12
}

View File

@@ -2793,25 +2793,6 @@ impl ApiTester {
self
}
<<<<<<< HEAD
pub async fn test_post_beacon_pool_payload_attestations_valid(mut self) -> Self {
let slot = self.chain.slot().unwrap();
let head_root = self.chain.head_beacon_block_root();
let message = PayloadAttestationMessage {
validator_index: 0,
data: PayloadAttestationData {
beacon_block_root: head_root,
slot,
payload_present: true,
blob_data_available: true,
},
signature: Signature::empty(),
};
self.client
.post_beacon_pool_payload_attestations(&[message])
=======
fn make_valid_payload_attestation_message(
&self,
ptc_offset: usize,
@@ -2867,7 +2848,6 @@ impl ApiTester {
self.client
.post_beacon_pool_payload_attestations(&[message], fork_name)
>>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12
.await
.unwrap();
@@ -2880,30 +2860,11 @@ impl ApiTester {
}
pub async fn test_post_beacon_pool_payload_attestations_valid_ssz(mut self) -> Self {
<<<<<<< HEAD
let slot = self.chain.slot().unwrap();
let head_root = self.chain.head_beacon_block_root();
let message = PayloadAttestationMessage {
validator_index: 0,
data: PayloadAttestationData {
beacon_block_root: head_root,
slot,
payload_present: true,
blob_data_available: true,
},
signature: Signature::empty(),
};
self.client
.post_beacon_pool_payload_attestations_ssz(&[message])
=======
let message = self.make_valid_payload_attestation_message(1);
let fork_name = self.chain.spec.fork_name_at_slot::<E>(message.data.slot);
self.client
.post_beacon_pool_payload_attestations_ssz(&[message], fork_name)
>>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12
.await
.unwrap();

View File

@@ -1793,10 +1793,7 @@ impl BeaconNodeHttpClient {
pub async fn post_beacon_pool_payload_attestations(
&self,
messages: &[PayloadAttestationMessage],
<<<<<<< HEAD
=======
fork_name: ForkName,
>>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12
) -> Result<(), Error> {
let mut path = self.eth_path(V1)?;
@@ -1806,11 +1803,7 @@ impl BeaconNodeHttpClient {
.push("pool")
.push("payload_attestations");
<<<<<<< HEAD
self.post_generic_with_consensus_version(path, &messages, None, ForkName::Gloas)
=======
self.post_generic_with_consensus_version(path, &messages, None, fork_name)
>>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12
.await?;
Ok(())
@@ -1820,10 +1813,7 @@ impl BeaconNodeHttpClient {
pub async fn post_beacon_pool_payload_attestations_ssz(
&self,
messages: &[PayloadAttestationMessage],
<<<<<<< HEAD
=======
fork_name: ForkName,
>>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12
) -> Result<(), Error> {
let mut path = self.eth_path(V1)?;
@@ -1835,18 +1825,8 @@ impl BeaconNodeHttpClient {
let ssz_body: Vec<u8> = messages.iter().flat_map(|m| m.as_ssz_bytes()).collect();
<<<<<<< HEAD
self.post_generic_with_consensus_version_and_ssz_body(
path,
ssz_body,
None,
ForkName::Gloas,
)
.await?;
=======
self.post_generic_with_consensus_version_and_ssz_body(path, ssz_body, None, fork_name)
.await?;
>>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12
Ok(())
}

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:?}")