mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 02:12:33 +00:00
Remove reprocess channel (#7437)
Partially https://github.com/sigp/lighthouse/issues/6291 This PR removes the reprocess event channel from being externally exposed. All work events are now sent through the single `BeaconProcessorSend` channel. I've introduced a new `Work::Reprocess` enum variant which we then use to schedule jobs for reprocess. I've also created a new scheduler module which will eventually house the different scheduler impls. This is all needed as an initial step to generalize the beacon processor A "full" implementation for the generalized beacon processor can be found here https://github.com/sigp/lighthouse/pull/6448 I'm going to try to break up the full implementation into smaller PR's so it can actually be reviewed
This commit is contained in:
@@ -546,7 +546,6 @@ where
|
||||
network_senders: None,
|
||||
network_globals: None,
|
||||
beacon_processor_send: None,
|
||||
beacon_processor_reprocess_send: None,
|
||||
eth1_service: Some(genesis_service.eth1_service.clone()),
|
||||
sse_logging_components: runtime_context.sse_logging_components.clone(),
|
||||
});
|
||||
@@ -638,7 +637,6 @@ where
|
||||
context.executor,
|
||||
libp2p_registry.as_mut(),
|
||||
beacon_processor_channels.beacon_processor_tx.clone(),
|
||||
beacon_processor_channels.work_reprocessing_tx.clone(),
|
||||
)
|
||||
.await
|
||||
.map_err(|e| format!("Failed to start network: {:?}", e))?;
|
||||
@@ -777,9 +775,6 @@ where
|
||||
network_globals: self.network_globals.clone(),
|
||||
eth1_service: self.eth1_service.clone(),
|
||||
beacon_processor_send: Some(beacon_processor_channels.beacon_processor_tx.clone()),
|
||||
beacon_processor_reprocess_send: Some(
|
||||
beacon_processor_channels.work_reprocessing_tx.clone(),
|
||||
),
|
||||
sse_logging_components: runtime_context.sse_logging_components.clone(),
|
||||
});
|
||||
|
||||
@@ -843,8 +838,6 @@ where
|
||||
}
|
||||
.spawn_manager(
|
||||
beacon_processor_channels.beacon_processor_rx,
|
||||
beacon_processor_channels.work_reprocessing_tx.clone(),
|
||||
beacon_processor_channels.work_reprocessing_rx,
|
||||
None,
|
||||
beacon_chain.slot_clock.clone(),
|
||||
beacon_chain.spec.maximum_gossip_clock_disparity(),
|
||||
@@ -918,7 +911,7 @@ where
|
||||
compute_light_client_updates(
|
||||
&inner_chain,
|
||||
light_client_server_rv,
|
||||
beacon_processor_channels.work_reprocessing_tx,
|
||||
beacon_processor_channels.beacon_processor_tx,
|
||||
)
|
||||
.await
|
||||
},
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use beacon_chain::{BeaconChain, BeaconChainTypes, LightClientProducerEvent};
|
||||
use beacon_processor::work_reprocessing_queue::ReprocessQueueMessage;
|
||||
use beacon_processor::{BeaconProcessorSend, Work, WorkEvent};
|
||||
use futures::channel::mpsc::Receiver;
|
||||
use futures::StreamExt;
|
||||
use tokio::sync::mpsc::Sender;
|
||||
use tracing::error;
|
||||
|
||||
// Each `LightClientProducerEvent` is ~200 bytes. With the light_client server producing only recent
|
||||
@@ -14,7 +14,7 @@ pub(crate) const LIGHT_CLIENT_SERVER_CHANNEL_CAPACITY: usize = 32;
|
||||
pub async fn compute_light_client_updates<T: BeaconChainTypes>(
|
||||
chain: &BeaconChain<T>,
|
||||
mut light_client_server_rv: Receiver<LightClientProducerEvent<T::EthSpec>>,
|
||||
reprocess_tx: Sender<ReprocessQueueMessage>,
|
||||
beacon_processor_send: BeaconProcessorSend<T::EthSpec>,
|
||||
) {
|
||||
// Should only receive events for recent blocks, import_block filters by blocks close to clock.
|
||||
//
|
||||
@@ -31,7 +31,13 @@ pub async fn compute_light_client_updates<T: BeaconChainTypes>(
|
||||
});
|
||||
|
||||
let msg = ReprocessQueueMessage::NewLightClientOptimisticUpdate { parent_root };
|
||||
if reprocess_tx.try_send(msg).is_err() {
|
||||
if beacon_processor_send
|
||||
.try_send(WorkEvent {
|
||||
drop_during_sync: true,
|
||||
work: Work::Reprocess(msg),
|
||||
})
|
||||
.is_err()
|
||||
{
|
||||
error!(%parent_root,"Failed to inform light client update")
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user