From bcae9370c73b36ae528db959b443346e72ee8fc7 Mon Sep 17 00:00:00 2001 From: Eitan Seri- Levi Date: Thu, 26 Mar 2026 22:58:05 -0700 Subject: [PATCH 1/4] implement min needed changes for dora --- .../beacon_chain/src/block_verification.rs | 8 ++ beacon_node/beacon_chain/src/events.rs | 30 ++++++++ .../payload_envelope_verification/import.rs | 12 ++- .../src/beacon/execution_payload_envelope.rs | 73 ++++++++++++++++++- beacon_node/http_api/src/lib.rs | 18 ++++- common/eth2/src/lib.rs | 49 +++++++++++++ common/eth2/src/types.rs | 32 ++++++++ 7 files changed, 219 insertions(+), 3 deletions(-) diff --git a/beacon_node/beacon_chain/src/block_verification.rs b/beacon_node/beacon_chain/src/block_verification.rs index 802b090f6a8..c6580cadb95 100644 --- a/beacon_node/beacon_chain/src/block_verification.rs +++ b/beacon_node/beacon_chain/src/block_verification.rs @@ -1031,6 +1031,14 @@ impl GossipVerifiedBlock { }))); } + // Beacon API execution_payload_bid events + if let Some(event_handler) = chain.event_handler.as_ref() + && event_handler.has_execution_payload_bid_subscribers() + && let Ok(bid) = block.message().body().signed_execution_payload_bid() + { + event_handler.register(EventKind::ExecutionPayloadBid(Box::new(bid.clone()))); + } + // Having checked the proposer index and the block root we can cache them. let consensus_context = ConsensusContext::new(block.slot()) .set_current_block_root(block_root) diff --git a/beacon_node/beacon_chain/src/events.rs b/beacon_node/beacon_chain/src/events.rs index 276edc3fe6f..9b3a3eae0f6 100644 --- a/beacon_node/beacon_chain/src/events.rs +++ b/beacon_node/beacon_chain/src/events.rs @@ -25,6 +25,8 @@ pub struct ServerSentEventHandler { attester_slashing_tx: Sender>, bls_to_execution_change_tx: Sender>, block_gossip_tx: Sender>, + execution_payload_bid_tx: Sender>, + execution_payload_available_tx: Sender>, } impl ServerSentEventHandler { @@ -51,6 +53,8 @@ impl ServerSentEventHandler { let (attester_slashing_tx, _) = broadcast::channel(capacity); let (bls_to_execution_change_tx, _) = broadcast::channel(capacity); let (block_gossip_tx, _) = broadcast::channel(capacity); + let (execution_payload_bid_tx, _) = broadcast::channel(capacity); + let (execution_payload_available_tx, _) = broadcast::channel(capacity); Self { attestation_tx, @@ -71,6 +75,8 @@ impl ServerSentEventHandler { attester_slashing_tx, bls_to_execution_change_tx, block_gossip_tx, + execution_payload_bid_tx, + execution_payload_available_tx, } } @@ -155,6 +161,14 @@ impl ServerSentEventHandler { .block_gossip_tx .send(kind) .map(|count| log_count("block gossip", count)), + EventKind::ExecutionPayloadBid(_) => self + .execution_payload_bid_tx + .send(kind) + .map(|count| log_count("execution payload bid", count)), + EventKind::ExecutionPayloadAvailable(_) => self + .execution_payload_available_tx + .send(kind) + .map(|count| log_count("execution payload available", count)), }; if let Err(SendError(event)) = result { trace!(?event, "No receivers registered to listen for event"); @@ -296,4 +310,20 @@ impl ServerSentEventHandler { pub fn has_block_gossip_subscribers(&self) -> bool { self.block_gossip_tx.receiver_count() > 0 } + + pub fn subscribe_execution_payload_bid(&self) -> Receiver> { + self.execution_payload_bid_tx.subscribe() + } + + pub fn subscribe_execution_payload_available(&self) -> Receiver> { + self.execution_payload_available_tx.subscribe() + } + + pub fn has_execution_payload_bid_subscribers(&self) -> bool { + self.execution_payload_bid_tx.receiver_count() > 0 + } + + pub fn has_execution_payload_available_subscribers(&self) -> bool { + self.execution_payload_available_tx.receiver_count() > 0 + } } diff --git a/beacon_node/beacon_chain/src/payload_envelope_verification/import.rs b/beacon_node/beacon_chain/src/payload_envelope_verification/import.rs index 2ee315e5592..6eecbb5dd2c 100644 --- a/beacon_node/beacon_chain/src/payload_envelope_verification/import.rs +++ b/beacon_node/beacon_chain/src/payload_envelope_verification/import.rs @@ -16,6 +16,7 @@ use crate::{ NotifyExecutionLayer, block_verification_types::AvailableBlockData, metrics, payload_envelope_verification::ExecutionPendingEnvelope, validator_monitor::get_slot_delay_ms, }; +use eth2::types::{EventKind, SseExecutionPayloadAvailable}; const ENVELOPE_METRICS_CACHE_SLOT_LIMIT: u32 = 64; @@ -349,6 +350,15 @@ impl BeaconChain { ); } - // TODO(gloas) emit SSE event for envelope import (similar to SseBlock for blocks). + if let Some(event_handler) = self.event_handler.as_ref() + && event_handler.has_execution_payload_available_subscribers() + { + event_handler.register(EventKind::ExecutionPayloadAvailable( + SseExecutionPayloadAvailable { + slot: envelope_slot, + block_root, + }, + )); + } } } diff --git a/beacon_node/http_api/src/beacon/execution_payload_envelope.rs b/beacon_node/http_api/src/beacon/execution_payload_envelope.rs index 81f2ea41ea9..1f827cee112 100644 --- a/beacon_node/http_api/src/beacon/execution_payload_envelope.rs +++ b/beacon_node/http_api/src/beacon/execution_payload_envelope.rs @@ -1,11 +1,17 @@ +use crate::block_id::BlockId; use crate::task_spawner::{Priority, TaskSpawner}; use crate::utils::{ChainFilter, EthV1Filter, NetworkTxFilter, ResponseFilter, TaskSpawnerFilter}; +use crate::version::{ + ResponseIncludesVersion, add_consensus_version_header, add_ssz_content_type_header, + execution_optimistic_finalized_beacon_response, +}; use beacon_chain::{BeaconChain, BeaconChainTypes}; use bytes::Bytes; +use eth2::types as api_types; use eth2::{CONTENT_TYPE_HEADER, SSZ_CONTENT_TYPE_HEADER}; use lighthouse_network::PubsubMessage; use network::NetworkMessage; -use ssz::Decode; +use ssz::{Decode, Encode}; use std::sync::Arc; use tokio::sync::mpsc::UnboundedSender; use tracing::{info, warn}; @@ -114,3 +120,68 @@ pub async fn publish_execution_payload_envelope( Ok(warp::reply().into_response()) } + +// TODO(epbs): add tests for this endpoint once we support importing payloads into the db +// GET beacon/execution_payload_envelope/{block_id} +pub(crate) fn get_beacon_execution_payload_envelope( + eth_v1: EthV1Filter, + block_id_or_err: impl Filter + Clone + Send + Sync + 'static, + task_spawner_filter: TaskSpawnerFilter, + chain_filter: ChainFilter, +) -> ResponseFilter { + eth_v1 + .and(warp::path("beacon")) + .and(warp::path("execution_payload_envelope")) + .and(block_id_or_err) + .and(warp::path::end()) + .and(task_spawner_filter) + .and(chain_filter) + .and(warp::header::optional::("accept")) + .then( + |block_id: BlockId, + task_spawner: TaskSpawner, + chain: Arc>, + accept_header: Option| { + task_spawner.blocking_response_task(Priority::P1, move || { + let (root, execution_optimistic, finalized) = block_id.root(&chain)?; + + let envelope = chain + .get_payload_envelope(&root) + .map_err(warp_utils::reject::unhandled_error)? + .ok_or_else(|| { + warp_utils::reject::custom_not_found(format!( + "execution payload envelope for block root {root}" + )) + })?; + + let fork_name = chain + .spec + .fork_name_at_slot::(envelope.message.slot); + + match accept_header { + Some(api_types::Accept::Ssz) => warp::http::Response::builder() + .status(200) + .body(warp::hyper::Body::from(envelope.as_ssz_bytes())) + .map(add_ssz_content_type_header) + .map_err(|e| { + warp_utils::reject::custom_server_error(format!( + "failed to create response: {}", + e + )) + }), + _ => { + let res = execution_optimistic_finalized_beacon_response( + ResponseIncludesVersion::Yes(fork_name), + execution_optimistic, + finalized, + &envelope, + )?; + Ok(warp::reply::json(&res).into_response()) + } + } + .map(|resp| add_consensus_version_header(resp, fork_name)) + }) + }, + ) + .boxed() +} diff --git a/beacon_node/http_api/src/lib.rs b/beacon_node/http_api/src/lib.rs index 29e2d39aee1..db25878c89c 100644 --- a/beacon_node/http_api/src/lib.rs +++ b/beacon_node/http_api/src/lib.rs @@ -35,7 +35,8 @@ mod validators; mod version; use crate::beacon::execution_payload_envelope::{ - post_beacon_execution_payload_envelope, post_beacon_execution_payload_envelope_ssz, + get_beacon_execution_payload_envelope, post_beacon_execution_payload_envelope, + post_beacon_execution_payload_envelope_ssz, }; use crate::beacon::pool::*; use crate::light_client::{get_light_client_bootstrap, get_light_client_updates}; @@ -1509,6 +1510,14 @@ pub fn serve( network_tx_filter.clone(), ); + // GET beacon/execution_payload_envelope/{block_id} + let get_beacon_execution_payload_envelope = get_beacon_execution_payload_envelope( + eth_v1.clone(), + block_id_or_err, + task_spawner_filter.clone(), + chain_filter.clone(), + ); + let beacon_rewards_path = eth_v1 .clone() .and(warp::path("beacon")) @@ -3158,6 +3167,12 @@ pub fn serve( api_types::EventTopic::BlockGossip => { event_handler.subscribe_block_gossip() } + api_types::EventTopic::ExecutionPayloadBid => { + event_handler.subscribe_execution_payload_bid() + } + api_types::EventTopic::ExecutionPayloadAvailable => { + event_handler.subscribe_execution_payload_available() + } }; receivers.push( @@ -3283,6 +3298,7 @@ pub fn serve( .uor(get_beacon_block_root) .uor(get_blob_sidecars) .uor(get_blobs) + .uor(get_beacon_execution_payload_envelope) .uor(get_beacon_pool_attestations) .uor(get_beacon_pool_attester_slashings) .uor(get_beacon_pool_proposer_slashings) diff --git a/common/eth2/src/lib.rs b/common/eth2/src/lib.rs index 40c5ef58a68..81ee48c8749 100644 --- a/common/eth2/src/lib.rs +++ b/common/eth2/src/lib.rs @@ -2732,6 +2732,55 @@ impl BeaconNodeHttpClient { Ok(()) } + /// Path for `v1/beacon/execution_payload_envelope/{block_id}` + pub fn get_beacon_execution_payload_envelope_path( + &self, + block_id: BlockId, + ) -> Result { + let mut path = self.eth_path(V1)?; + path.path_segments_mut() + .map_err(|()| Error::InvalidUrl(self.server.clone()))? + .push("beacon") + .push("execution_payload_envelope") + .push(&block_id.to_string()); + Ok(path) + } + + /// `GET v1/beacon/execution_payload_envelope/{block_id}` + /// + /// Returns `Ok(None)` on a 404 error. + pub async fn get_beacon_execution_payload_envelope( + &self, + block_id: BlockId, + ) -> Result>>, Error> + { + let path = self.get_beacon_execution_payload_envelope_path(block_id)?; + self.get_opt(path) + .await + .map(|opt| opt.map(BeaconResponse::ForkVersioned)) + } + + /// `GET v1/beacon/execution_payload_envelope/{block_id}` in SSZ format + /// + /// Returns `Ok(None)` on a 404 error. + pub async fn get_beacon_execution_payload_envelope_ssz( + &self, + block_id: BlockId, + ) -> Result>, Error> { + let path = self.get_beacon_execution_payload_envelope_path(block_id)?; + let opt_response = self + .get_bytes_opt_accept_header(path, Accept::Ssz, self.timeouts.get_beacon_blocks_ssz) + .await?; + match opt_response { + Some(bytes) => { + SignedExecutionPayloadEnvelope::from_ssz_bytes(&bytes) + .map(Some) + .map_err(Error::InvalidSsz) + } + None => Ok(None), + } + } + /// `GET v2/validator/blocks/{slot}` in ssz format pub async fn get_validator_blocks_ssz( &self, diff --git a/common/eth2/src/types.rs b/common/eth2/src/types.rs index 94dff95bc64..b7455e507e6 100644 --- a/common/eth2/src/types.rs +++ b/common/eth2/src/types.rs @@ -1070,6 +1070,12 @@ pub struct BlockGossip { pub slot: Slot, pub block: Hash256, } + +#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)] +pub struct SseExecutionPayloadAvailable { + pub slot: Slot, + pub block_root: Hash256, +} #[derive(PartialEq, Debug, Serialize, Deserialize, Clone)] pub struct SseChainReorg { pub slot: Slot, @@ -1210,6 +1216,8 @@ pub enum EventKind { AttesterSlashing(Box>), BlsToExecutionChange(Box), BlockGossip(Box), + ExecutionPayloadBid(Box>), + ExecutionPayloadAvailable(SseExecutionPayloadAvailable), } impl EventKind { @@ -1233,6 +1241,8 @@ impl EventKind { EventKind::AttesterSlashing(_) => "attester_slashing", EventKind::BlsToExecutionChange(_) => "bls_to_execution_change", EventKind::BlockGossip(_) => "block_gossip", + EventKind::ExecutionPayloadBid(_) => "execution_payload_bid", + EventKind::ExecutionPayloadAvailable(_) => "execution_payload_available", } } @@ -1322,6 +1332,22 @@ impl EventKind { "block_gossip" => Ok(EventKind::BlockGossip(serde_json::from_str(data).map_err( |e| ServerError::InvalidServerSentEvent(format!("Block Gossip: {:?}", e)), )?)), + "execution_payload_bid" => Ok(EventKind::ExecutionPayloadBid( + serde_json::from_str(data).map_err(|e| { + ServerError::InvalidServerSentEvent(format!( + "Execution Payload Bid: {:?}", + e + )) + })?, + )), + "execution_payload_available" => Ok(EventKind::ExecutionPayloadAvailable( + serde_json::from_str(data).map_err(|e| { + ServerError::InvalidServerSentEvent(format!( + "Execution Payload Available: {:?}", + e + )) + })?, + )), _ => Err(ServerError::InvalidServerSentEvent( "Could not parse event tag".to_string(), )), @@ -1357,6 +1383,8 @@ pub enum EventTopic { ProposerSlashing, BlsToExecutionChange, BlockGossip, + ExecutionPayloadBid, + ExecutionPayloadAvailable, } impl FromStr for EventTopic { @@ -1382,6 +1410,8 @@ impl FromStr for EventTopic { "proposer_slashing" => Ok(EventTopic::ProposerSlashing), "bls_to_execution_change" => Ok(EventTopic::BlsToExecutionChange), "block_gossip" => Ok(EventTopic::BlockGossip), + "execution_payload_bid" => Ok(EventTopic::ExecutionPayloadBid), + "execution_payload_available" => Ok(EventTopic::ExecutionPayloadAvailable), _ => Err("event topic cannot be parsed.".to_string()), } } @@ -1408,6 +1438,8 @@ impl fmt::Display for EventTopic { EventTopic::ProposerSlashing => write!(f, "proposer_slashing"), EventTopic::BlsToExecutionChange => write!(f, "bls_to_execution_change"), EventTopic::BlockGossip => write!(f, "block_gossip"), + EventTopic::ExecutionPayloadBid => write!(f, "execution_payload_bid"), + EventTopic::ExecutionPayloadAvailable => write!(f, "execution_payload_available"), } } } From 3f60b20696a58cced758aefdb95375e6059b9bf6 Mon Sep 17 00:00:00 2001 From: Eitan Seri- Levi Date: Thu, 26 Mar 2026 23:01:38 -0700 Subject: [PATCH 2/4] fix comments --- beacon_node/beacon_chain/src/block_verification.rs | 1 - .../src/beacon/execution_payload_envelope.rs | 8 ++++++-- common/eth2/src/lib.rs | 14 +++++++------- common/eth2/src/types.rs | 5 +---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/beacon_node/beacon_chain/src/block_verification.rs b/beacon_node/beacon_chain/src/block_verification.rs index c6580cadb95..10f79519ec0 100644 --- a/beacon_node/beacon_chain/src/block_verification.rs +++ b/beacon_node/beacon_chain/src/block_verification.rs @@ -1031,7 +1031,6 @@ impl GossipVerifiedBlock { }))); } - // Beacon API execution_payload_bid events if let Some(event_handler) = chain.event_handler.as_ref() && event_handler.has_execution_payload_bid_subscribers() && let Ok(bid) = block.message().body().signed_execution_payload_bid() diff --git a/beacon_node/http_api/src/beacon/execution_payload_envelope.rs b/beacon_node/http_api/src/beacon/execution_payload_envelope.rs index 1f827cee112..d5ed60eba81 100644 --- a/beacon_node/http_api/src/beacon/execution_payload_envelope.rs +++ b/beacon_node/http_api/src/beacon/execution_payload_envelope.rs @@ -121,11 +121,15 @@ pub async fn publish_execution_payload_envelope( Ok(warp::reply().into_response()) } -// TODO(epbs): add tests for this endpoint once we support importing payloads into the db +// TODO(gloas): add tests for this endpoint once we support importing payloads into the db // GET beacon/execution_payload_envelope/{block_id} pub(crate) fn get_beacon_execution_payload_envelope( eth_v1: EthV1Filter, - block_id_or_err: impl Filter + Clone + Send + Sync + 'static, + block_id_or_err: impl Filter + + Clone + + Send + + Sync + + 'static, task_spawner_filter: TaskSpawnerFilter, chain_filter: ChainFilter, ) -> ResponseFilter { diff --git a/common/eth2/src/lib.rs b/common/eth2/src/lib.rs index 81ee48c8749..d5140a3878d 100644 --- a/common/eth2/src/lib.rs +++ b/common/eth2/src/lib.rs @@ -2752,8 +2752,10 @@ impl BeaconNodeHttpClient { pub async fn get_beacon_execution_payload_envelope( &self, block_id: BlockId, - ) -> Result>>, Error> - { + ) -> Result< + Option>>, + Error, + > { let path = self.get_beacon_execution_payload_envelope_path(block_id)?; self.get_opt(path) .await @@ -2772,11 +2774,9 @@ impl BeaconNodeHttpClient { .get_bytes_opt_accept_header(path, Accept::Ssz, self.timeouts.get_beacon_blocks_ssz) .await?; match opt_response { - Some(bytes) => { - SignedExecutionPayloadEnvelope::from_ssz_bytes(&bytes) - .map(Some) - .map_err(Error::InvalidSsz) - } + Some(bytes) => SignedExecutionPayloadEnvelope::from_ssz_bytes(&bytes) + .map(Some) + .map_err(Error::InvalidSsz), None => Ok(None), } } diff --git a/common/eth2/src/types.rs b/common/eth2/src/types.rs index b7455e507e6..4eef3e3faa8 100644 --- a/common/eth2/src/types.rs +++ b/common/eth2/src/types.rs @@ -1334,10 +1334,7 @@ impl EventKind { )?)), "execution_payload_bid" => Ok(EventKind::ExecutionPayloadBid( serde_json::from_str(data).map_err(|e| { - ServerError::InvalidServerSentEvent(format!( - "Execution Payload Bid: {:?}", - e - )) + ServerError::InvalidServerSentEvent(format!("Execution Payload Bid: {:?}", e)) })?, )), "execution_payload_available" => Ok(EventKind::ExecutionPayloadAvailable( From 1dbbcea112862e4418092c342e8dbb6f33018450 Mon Sep 17 00:00:00 2001 From: Eitan Seri- Levi Date: Thu, 26 Mar 2026 23:17:02 -0700 Subject: [PATCH 3/4] Ensure consistency --- beacon_node/beacon_chain/src/events.rs | 16 ++++++++-------- .../src/beacon/execution_payload_envelope.rs | 13 ++++++++----- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/beacon_node/beacon_chain/src/events.rs b/beacon_node/beacon_chain/src/events.rs index 9b3a3eae0f6..d7f9b10607c 100644 --- a/beacon_node/beacon_chain/src/events.rs +++ b/beacon_node/beacon_chain/src/events.rs @@ -247,6 +247,14 @@ impl ServerSentEventHandler { self.block_gossip_tx.subscribe() } + pub fn subscribe_execution_payload_bid(&self) -> Receiver> { + self.execution_payload_bid_tx.subscribe() + } + + pub fn subscribe_execution_payload_available(&self) -> Receiver> { + self.execution_payload_available_tx.subscribe() + } + pub fn has_attestation_subscribers(&self) -> bool { self.attestation_tx.receiver_count() > 0 } @@ -311,14 +319,6 @@ impl ServerSentEventHandler { self.block_gossip_tx.receiver_count() > 0 } - pub fn subscribe_execution_payload_bid(&self) -> Receiver> { - self.execution_payload_bid_tx.subscribe() - } - - pub fn subscribe_execution_payload_available(&self) -> Receiver> { - self.execution_payload_available_tx.subscribe() - } - pub fn has_execution_payload_bid_subscribers(&self) -> bool { self.execution_payload_bid_tx.receiver_count() > 0 } diff --git a/beacon_node/http_api/src/beacon/execution_payload_envelope.rs b/beacon_node/http_api/src/beacon/execution_payload_envelope.rs index d5ed60eba81..4a974c9919a 100644 --- a/beacon_node/http_api/src/beacon/execution_payload_envelope.rs +++ b/beacon_node/http_api/src/beacon/execution_payload_envelope.rs @@ -16,7 +16,10 @@ use std::sync::Arc; use tokio::sync::mpsc::UnboundedSender; use tracing::{info, warn}; use types::SignedExecutionPayloadEnvelope; -use warp::{Filter, Rejection, Reply, reply::Response}; +use warp::{ + Filter, Rejection, Reply, + hyper::{Body, Response}, +}; // POST beacon/execution_payload_envelope (SSZ) pub(crate) fn post_beacon_execution_payload_envelope_ssz( @@ -87,7 +90,7 @@ pub async fn publish_execution_payload_envelope( envelope: SignedExecutionPayloadEnvelope, chain: Arc>, network_tx: &UnboundedSender>, -) -> Result { +) -> Result, Rejection> { let slot = envelope.message.slot; let beacon_block_root = envelope.message.beacon_block_root; @@ -163,10 +166,10 @@ pub(crate) fn get_beacon_execution_payload_envelope( .fork_name_at_slot::(envelope.message.slot); match accept_header { - Some(api_types::Accept::Ssz) => warp::http::Response::builder() + Some(api_types::Accept::Ssz) => Response::builder() .status(200) - .body(warp::hyper::Body::from(envelope.as_ssz_bytes())) - .map(add_ssz_content_type_header) + .body(envelope.as_ssz_bytes().into()) + .map(|res: Response| add_ssz_content_type_header(res)) .map_err(|e| { warp_utils::reject::custom_server_error(format!( "failed to create response: {}", From 8eca22b74fdf2d4178be962af2e4b6e47e843053 Mon Sep 17 00:00:00 2001 From: Eitan Seri- Levi Date: Sun, 29 Mar 2026 08:04:32 -0700 Subject: [PATCH 4/4] reduce PR scope --- .../beacon_chain/src/block_verification.rs | 7 ----- beacon_node/beacon_chain/src/events.rs | 30 ------------------- .../payload_envelope_verification/import.rs | 12 +------- beacon_node/http_api/src/lib.rs | 6 ---- common/eth2/src/types.rs | 29 ------------------ 5 files changed, 1 insertion(+), 83 deletions(-) diff --git a/beacon_node/beacon_chain/src/block_verification.rs b/beacon_node/beacon_chain/src/block_verification.rs index 10f79519ec0..802b090f6a8 100644 --- a/beacon_node/beacon_chain/src/block_verification.rs +++ b/beacon_node/beacon_chain/src/block_verification.rs @@ -1031,13 +1031,6 @@ impl GossipVerifiedBlock { }))); } - if let Some(event_handler) = chain.event_handler.as_ref() - && event_handler.has_execution_payload_bid_subscribers() - && let Ok(bid) = block.message().body().signed_execution_payload_bid() - { - event_handler.register(EventKind::ExecutionPayloadBid(Box::new(bid.clone()))); - } - // Having checked the proposer index and the block root we can cache them. let consensus_context = ConsensusContext::new(block.slot()) .set_current_block_root(block_root) diff --git a/beacon_node/beacon_chain/src/events.rs b/beacon_node/beacon_chain/src/events.rs index d7f9b10607c..276edc3fe6f 100644 --- a/beacon_node/beacon_chain/src/events.rs +++ b/beacon_node/beacon_chain/src/events.rs @@ -25,8 +25,6 @@ pub struct ServerSentEventHandler { attester_slashing_tx: Sender>, bls_to_execution_change_tx: Sender>, block_gossip_tx: Sender>, - execution_payload_bid_tx: Sender>, - execution_payload_available_tx: Sender>, } impl ServerSentEventHandler { @@ -53,8 +51,6 @@ impl ServerSentEventHandler { let (attester_slashing_tx, _) = broadcast::channel(capacity); let (bls_to_execution_change_tx, _) = broadcast::channel(capacity); let (block_gossip_tx, _) = broadcast::channel(capacity); - let (execution_payload_bid_tx, _) = broadcast::channel(capacity); - let (execution_payload_available_tx, _) = broadcast::channel(capacity); Self { attestation_tx, @@ -75,8 +71,6 @@ impl ServerSentEventHandler { attester_slashing_tx, bls_to_execution_change_tx, block_gossip_tx, - execution_payload_bid_tx, - execution_payload_available_tx, } } @@ -161,14 +155,6 @@ impl ServerSentEventHandler { .block_gossip_tx .send(kind) .map(|count| log_count("block gossip", count)), - EventKind::ExecutionPayloadBid(_) => self - .execution_payload_bid_tx - .send(kind) - .map(|count| log_count("execution payload bid", count)), - EventKind::ExecutionPayloadAvailable(_) => self - .execution_payload_available_tx - .send(kind) - .map(|count| log_count("execution payload available", count)), }; if let Err(SendError(event)) = result { trace!(?event, "No receivers registered to listen for event"); @@ -247,14 +233,6 @@ impl ServerSentEventHandler { self.block_gossip_tx.subscribe() } - pub fn subscribe_execution_payload_bid(&self) -> Receiver> { - self.execution_payload_bid_tx.subscribe() - } - - pub fn subscribe_execution_payload_available(&self) -> Receiver> { - self.execution_payload_available_tx.subscribe() - } - pub fn has_attestation_subscribers(&self) -> bool { self.attestation_tx.receiver_count() > 0 } @@ -318,12 +296,4 @@ impl ServerSentEventHandler { pub fn has_block_gossip_subscribers(&self) -> bool { self.block_gossip_tx.receiver_count() > 0 } - - pub fn has_execution_payload_bid_subscribers(&self) -> bool { - self.execution_payload_bid_tx.receiver_count() > 0 - } - - pub fn has_execution_payload_available_subscribers(&self) -> bool { - self.execution_payload_available_tx.receiver_count() > 0 - } } diff --git a/beacon_node/beacon_chain/src/payload_envelope_verification/import.rs b/beacon_node/beacon_chain/src/payload_envelope_verification/import.rs index 6eecbb5dd2c..2ee315e5592 100644 --- a/beacon_node/beacon_chain/src/payload_envelope_verification/import.rs +++ b/beacon_node/beacon_chain/src/payload_envelope_verification/import.rs @@ -16,7 +16,6 @@ use crate::{ NotifyExecutionLayer, block_verification_types::AvailableBlockData, metrics, payload_envelope_verification::ExecutionPendingEnvelope, validator_monitor::get_slot_delay_ms, }; -use eth2::types::{EventKind, SseExecutionPayloadAvailable}; const ENVELOPE_METRICS_CACHE_SLOT_LIMIT: u32 = 64; @@ -350,15 +349,6 @@ impl BeaconChain { ); } - if let Some(event_handler) = self.event_handler.as_ref() - && event_handler.has_execution_payload_available_subscribers() - { - event_handler.register(EventKind::ExecutionPayloadAvailable( - SseExecutionPayloadAvailable { - slot: envelope_slot, - block_root, - }, - )); - } + // TODO(gloas) emit SSE event for envelope import (similar to SseBlock for blocks). } } diff --git a/beacon_node/http_api/src/lib.rs b/beacon_node/http_api/src/lib.rs index db25878c89c..0dd17dcd11f 100644 --- a/beacon_node/http_api/src/lib.rs +++ b/beacon_node/http_api/src/lib.rs @@ -3167,12 +3167,6 @@ pub fn serve( api_types::EventTopic::BlockGossip => { event_handler.subscribe_block_gossip() } - api_types::EventTopic::ExecutionPayloadBid => { - event_handler.subscribe_execution_payload_bid() - } - api_types::EventTopic::ExecutionPayloadAvailable => { - event_handler.subscribe_execution_payload_available() - } }; receivers.push( diff --git a/common/eth2/src/types.rs b/common/eth2/src/types.rs index 4eef3e3faa8..94dff95bc64 100644 --- a/common/eth2/src/types.rs +++ b/common/eth2/src/types.rs @@ -1070,12 +1070,6 @@ pub struct BlockGossip { pub slot: Slot, pub block: Hash256, } - -#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)] -pub struct SseExecutionPayloadAvailable { - pub slot: Slot, - pub block_root: Hash256, -} #[derive(PartialEq, Debug, Serialize, Deserialize, Clone)] pub struct SseChainReorg { pub slot: Slot, @@ -1216,8 +1210,6 @@ pub enum EventKind { AttesterSlashing(Box>), BlsToExecutionChange(Box), BlockGossip(Box), - ExecutionPayloadBid(Box>), - ExecutionPayloadAvailable(SseExecutionPayloadAvailable), } impl EventKind { @@ -1241,8 +1233,6 @@ impl EventKind { EventKind::AttesterSlashing(_) => "attester_slashing", EventKind::BlsToExecutionChange(_) => "bls_to_execution_change", EventKind::BlockGossip(_) => "block_gossip", - EventKind::ExecutionPayloadBid(_) => "execution_payload_bid", - EventKind::ExecutionPayloadAvailable(_) => "execution_payload_available", } } @@ -1332,19 +1322,6 @@ impl EventKind { "block_gossip" => Ok(EventKind::BlockGossip(serde_json::from_str(data).map_err( |e| ServerError::InvalidServerSentEvent(format!("Block Gossip: {:?}", e)), )?)), - "execution_payload_bid" => Ok(EventKind::ExecutionPayloadBid( - serde_json::from_str(data).map_err(|e| { - ServerError::InvalidServerSentEvent(format!("Execution Payload Bid: {:?}", e)) - })?, - )), - "execution_payload_available" => Ok(EventKind::ExecutionPayloadAvailable( - serde_json::from_str(data).map_err(|e| { - ServerError::InvalidServerSentEvent(format!( - "Execution Payload Available: {:?}", - e - )) - })?, - )), _ => Err(ServerError::InvalidServerSentEvent( "Could not parse event tag".to_string(), )), @@ -1380,8 +1357,6 @@ pub enum EventTopic { ProposerSlashing, BlsToExecutionChange, BlockGossip, - ExecutionPayloadBid, - ExecutionPayloadAvailable, } impl FromStr for EventTopic { @@ -1407,8 +1382,6 @@ impl FromStr for EventTopic { "proposer_slashing" => Ok(EventTopic::ProposerSlashing), "bls_to_execution_change" => Ok(EventTopic::BlsToExecutionChange), "block_gossip" => Ok(EventTopic::BlockGossip), - "execution_payload_bid" => Ok(EventTopic::ExecutionPayloadBid), - "execution_payload_available" => Ok(EventTopic::ExecutionPayloadAvailable), _ => Err("event topic cannot be parsed.".to_string()), } } @@ -1435,8 +1408,6 @@ impl fmt::Display for EventTopic { EventTopic::ProposerSlashing => write!(f, "proposer_slashing"), EventTopic::BlsToExecutionChange => write!(f, "bls_to_execution_change"), EventTopic::BlockGossip => write!(f, "block_gossip"), - EventTopic::ExecutionPayloadBid => write!(f, "execution_payload_bid"), - EventTopic::ExecutionPayloadAvailable => write!(f, "execution_payload_available"), } } }