diff --git a/beacon_node/beacon_chain/src/payload_attestation_verification/tests.rs b/beacon_node/beacon_chain/src/payload_attestation_verification/tests.rs index 2456ad70e4..7faad98e55 100644 --- a/beacon_node/beacon_chain/src/payload_attestation_verification/tests.rs +++ b/beacon_node/beacon_chain/src/payload_attestation_verification/tests.rs @@ -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 diff --git a/beacon_node/http_api/src/beacon/pool.rs b/beacon_node/http_api/src/beacon/pool.rs index ac998f0b8b..c6b8a69643 100644 --- a/beacon_node/http_api/src/beacon/pool.rs +++ b/beacon_node/http_api/src/beacon/pool.rs @@ -543,20 +543,12 @@ pub fn post_beacon_pool_payload_attestations( .and(network_tx_filter.clone()) .then( |task_spawner: TaskSpawner, -<<<<<<< HEAD - _chain: Arc>, -======= chain: Arc>, ->>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12 messages: Vec, _fork_name: Option, network_tx: UnboundedSender>| { 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( .then( |body_bytes: Bytes, task_spawner: TaskSpawner, -<<<<<<< HEAD - _chain: Arc>, -======= chain: Arc>, ->>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12 network_tx: UnboundedSender>| { task_spawner.blocking_json_task(Priority::P0, move || { let item_len = ::ssz_fixed_len(); @@ -608,31 +596,13 @@ pub fn post_beacon_pool_payload_attestations_ssz( }) .collect::>()?; -<<<<<<< HEAD - publish_payload_attestation_messages(&network_tx, messages) -======= publish_payload_attestation_messages(&chain, &network_tx, messages) ->>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12 }) }, ) .boxed() } -<<<<<<< HEAD -fn publish_payload_attestation_messages( - network_tx: &UnboundedSender>, - messages: Vec, -) -> 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( chain: &BeaconChain, network_tx: &UnboundedSender>, @@ -690,5 +660,4 @@ fn publish_payload_attestation_messages( failures, )) } ->>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12 } diff --git a/beacon_node/http_api/tests/tests.rs b/beacon_node/http_api/tests/tests.rs index 0354d1e8ab..b8326f4495 100644 --- a/beacon_node/http_api/tests/tests.rs +++ b/beacon_node/http_api/tests/tests.rs @@ -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::(message.data.slot); self.client .post_beacon_pool_payload_attestations_ssz(&[message], fork_name) ->>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12 .await .unwrap(); diff --git a/common/eth2/src/lib.rs b/common/eth2/src/lib.rs index 436d3fd996..e866547b9f 100644 --- a/common/eth2/src/lib.rs +++ b/common/eth2/src/lib.rs @@ -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 = 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(()) } diff --git a/validator_client/src/lib.rs b/validator_client/src/lib.rs index 369bf8fa16..b1b81bc0ea 100644 --- a/validator_client/src/lib.rs +++ b/validator_client/src/lib.rs @@ -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 ProductionValidatorClient { 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 ProductionValidatorClient { context.executor.clone(), context.eth2_config.spec.clone(), ); ->>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12 Ok(Self { context, @@ -656,19 +640,12 @@ impl ProductionValidatorClient { .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() diff --git a/validator_client/validator_services/src/payload_attestation_service.rs b/validator_client/validator_services/src/payload_attestation_service.rs index 4211d563bb..b3b0c0ee9c 100644 --- a/validator_client/validator_services/src/payload_attestation_service.rs +++ b/validator_client/validator_services/src/payload_attestation_service.rs @@ -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 { - duties_service: Option>>, - validator_store: Option>, - slot_clock: Option, - beacon_nodes: Option>>, - executor: Option, - chain_spec: Option>, -} - -impl Default - for PayloadAttestationServiceBuilder -{ - fn default() -> Self { - Self::new() - } -} - -impl PayloadAttestationServiceBuilder { - 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>) -> Self { - self.duties_service = Some(service); - self - } - - pub fn validator_store(mut self, store: Arc) -> 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>) -> 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) -> Self { - self.chain_spec = Some(chain_spec); - self - } - - pub fn build(self) -> Result, 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 { duties_service: Arc>, validator_store: Arc, @@ -131,8 +40,6 @@ impl Deref for PayloadAttestationService { } impl PayloadAttestationService { -<<<<<<< HEAD -======= pub fn new( duties_service: Arc>, validator_store: Arc, @@ -153,7 +60,6 @@ impl 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 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 PayloadAttestationServ .fork_name_at_slot::(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 PayloadAttestationServ } sleep(duration_to_next_slot + payload_attestation_due).await; ->>>>>>> 028b5a42a9715c31f416d45db70add39d9934b12 let service = self.clone(); self.executor.spawn( @@ -232,23 +117,17 @@ impl 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 PayloadAttestationServ } let count = messages.len(); -<<<<<<< HEAD -======= + let fork_name = self.chain_spec.fork_name_at_slot::(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 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:?}")