add reprocess queue

This commit is contained in:
Eitan Seri- Levi
2026-03-02 13:02:56 -08:00
parent a937802dc3
commit 73caa1d1b1
4 changed files with 166 additions and 5 deletions

View File

@@ -41,7 +41,8 @@
pub use crate::scheduler::BeaconProcessorQueueLengths;
use crate::scheduler::work_queue::WorkQueues;
use crate::work_reprocessing_queue::{
QueuedBackfillBatch, QueuedColumnReconstruction, QueuedGossipBlock, ReprocessQueueMessage,
QueuedBackfillBatch, QueuedColumnReconstruction, QueuedGossipBlock, QueuedGossipEnvelope,
ReprocessQueueMessage,
};
use futures::stream::{Stream, StreamExt};
use futures::task::Poll;
@@ -242,6 +243,18 @@ impl<E: EthSpec> From<ReadyWork> for WorkEvent<E> {
process_fn,
},
},
ReadyWork::Envelope(QueuedGossipEnvelope {
beacon_block_slot,
beacon_block_root,
process_fn,
}) => Self {
drop_during_sync: false,
work: Work::DelayedImportEnvelope {
beacon_block_slot,
beacon_block_root,
process_fn,
},
},
ReadyWork::RpcBlock(QueuedRpcBlock {
beacon_block_root,
process_fn,
@@ -384,6 +397,11 @@ pub enum Work<E: EthSpec> {
beacon_block_root: Hash256,
process_fn: AsyncFn,
},
DelayedImportEnvelope {
beacon_block_slot: Slot,
beacon_block_root: Hash256,
process_fn: AsyncFn,
},
GossipVoluntaryExit(BlockingFn),
GossipProposerSlashing(BlockingFn),
GossipAttesterSlashing(BlockingFn),
@@ -447,6 +465,7 @@ pub enum WorkType {
GossipBlobSidecar,
GossipDataColumnSidecar,
DelayedImportBlock,
DelayedImportEnvelope,
GossipVoluntaryExit,
GossipProposerSlashing,
GossipAttesterSlashing,
@@ -498,6 +517,7 @@ impl<E: EthSpec> Work<E> {
Work::GossipBlobSidecar(_) => WorkType::GossipBlobSidecar,
Work::GossipDataColumnSidecar(_) => WorkType::GossipDataColumnSidecar,
Work::DelayedImportBlock { .. } => WorkType::DelayedImportBlock,
Work::DelayedImportEnvelope { .. } => WorkType::DelayedImportEnvelope,
Work::GossipVoluntaryExit(_) => WorkType::GossipVoluntaryExit,
Work::GossipProposerSlashing(_) => WorkType::GossipProposerSlashing,
Work::GossipAttesterSlashing(_) => WorkType::GossipAttesterSlashing,
@@ -793,6 +813,8 @@ impl<E: EthSpec> BeaconProcessor<E> {
// on the delayed ones.
} else if let Some(item) = work_queues.delayed_block_queue.pop() {
Some(item)
} else if let Some(item) = work_queues.delayed_envelope_queue.pop() {
Some(item)
// Check gossip blocks and payloads before gossip attestations, since a block might be
// required to verify some attestations.
} else if let Some(item) = work_queues.gossip_block_queue.pop() {
@@ -1111,6 +1133,9 @@ impl<E: EthSpec> BeaconProcessor<E> {
Work::DelayedImportBlock { .. } => {
work_queues.delayed_block_queue.push(work, work_id)
}
Work::DelayedImportEnvelope { .. } => {
work_queues.delayed_envelope_queue.push(work, work_id)
}
Work::GossipVoluntaryExit { .. } => {
work_queues.gossip_voluntary_exit_queue.push(work, work_id)
}
@@ -1238,6 +1263,7 @@ impl<E: EthSpec> BeaconProcessor<E> {
work_queues.gossip_data_column_queue.len()
}
WorkType::DelayedImportBlock => work_queues.delayed_block_queue.len(),
WorkType::DelayedImportEnvelope => work_queues.delayed_envelope_queue.len(),
WorkType::GossipVoluntaryExit => {
work_queues.gossip_voluntary_exit_queue.len()
}
@@ -1435,6 +1461,11 @@ impl<E: EthSpec> BeaconProcessor<E> {
beacon_block_slot: _,
beacon_block_root: _,
process_fn,
}
| Work::DelayedImportEnvelope {
beacon_block_slot: _,
beacon_block_root: _,
process_fn,
} => task_spawner.spawn_async(process_fn),
Work::RpcBlock {
process_fn,