Gloas lookup sync boilerplate (#9322)

Implements the boring boilerplate to send envelopes by root requests and process them. Pre-step to

- https://github.com/sigp/lighthouse/pull/9155


  


Co-Authored-By: dapplion <35266934+dapplion@users.noreply.github.com>
This commit is contained in:
Lion - dapplion
2026-05-20 06:56:49 -06:00
committed by GitHub
parent 398efc3acc
commit 2c76ee5b6b
12 changed files with 398 additions and 8 deletions

View File

@@ -26,6 +26,7 @@ use tokio_stream::wrappers::UnboundedReceiverStream;
use tracing::{debug, error, trace, warn};
use types::{
BlobSidecar, DataColumnSidecar, EthSpec, ForkContext, PartialDataColumn, SignedBeaconBlock,
SignedExecutionPayloadEnvelope,
};
/// Handles messages from the network and routes them to the appropriate service to be handled.
@@ -348,10 +349,13 @@ impl<T: BeaconChainTypes> Router<T> {
Response::DataColumnsByRange(data_column) => {
self.on_data_columns_by_range_response(peer_id, app_request_id, data_column);
}
// TODO(EIP-7732): implement outgoing payload envelopes by range and root
// responses once sync manager requests them.
Response::PayloadEnvelopesByRoot(_) | Response::PayloadEnvelopesByRange(_) => {
debug!("Requesting envelopes by root and by range not supported yet");
Response::PayloadEnvelopesByRoot(envelope) => {
self.on_payload_envelopes_by_root_response(peer_id, app_request_id, envelope);
}
// TODO(EIP-7732): implement outgoing payload envelopes by range responses
// once sync manager requests them.
Response::PayloadEnvelopesByRange(_) => {
debug!("Requesting envelopes by range not supported yet");
}
// Lighthouse currently only serves BlocksByHead and does not issue it as a client,
// so receiving a response is unexpected. Drop it without crashing.
@@ -821,6 +825,29 @@ impl<T: BeaconChainTypes> Router<T> {
}
}
/// Handle a `PayloadEnvelopesByRoot` response from the peer.
pub fn on_payload_envelopes_by_root_response(
&mut self,
peer_id: PeerId,
app_request_id: AppRequestId,
envelope: Option<Arc<SignedExecutionPayloadEnvelope<T::EthSpec>>>,
) {
let sync_request_id = match app_request_id {
AppRequestId::Sync(id @ SyncRequestId::SinglePayloadEnvelope { .. }) => id,
other => {
crit!(request = ?other, %peer_id, "PayloadEnvelopesByRoot response on incorrect request");
return;
}
};
self.send_to_sync(SyncMessage::RpcPayloadEnvelope {
sync_request_id,
peer_id,
envelope,
seen_timestamp: self.chain.slot_clock.now_duration().unwrap_or_default(),
});
}
fn handle_beacon_processor_send_result(
&mut self,
result: Result<(), crate::network_beacon_processor::Error<T::EthSpec>>,