mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 04:37:13 +00:00
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:
@@ -418,6 +418,7 @@ pub enum Work<E: EthSpec> {
|
||||
process_fn: AsyncFn,
|
||||
},
|
||||
RpcCustodyColumn(AsyncFn),
|
||||
RpcEnvelope(AsyncFn),
|
||||
ColumnReconstruction(AsyncFn),
|
||||
IgnoredRpcBlock {
|
||||
process_fn: BlockingFn,
|
||||
@@ -485,6 +486,7 @@ pub enum WorkType {
|
||||
RpcBlock,
|
||||
RpcBlobs,
|
||||
RpcCustodyColumn,
|
||||
RpcEnvelope,
|
||||
ColumnReconstruction,
|
||||
IgnoredRpcBlock,
|
||||
ChainSegment,
|
||||
@@ -548,6 +550,7 @@ impl<E: EthSpec> Work<E> {
|
||||
Work::RpcBlock { .. } => WorkType::RpcBlock,
|
||||
Work::RpcBlobs { .. } => WorkType::RpcBlobs,
|
||||
Work::RpcCustodyColumn { .. } => WorkType::RpcCustodyColumn,
|
||||
Work::RpcEnvelope(_) => WorkType::RpcEnvelope,
|
||||
Work::ColumnReconstruction(_) => WorkType::ColumnReconstruction,
|
||||
Work::IgnoredRpcBlock { .. } => WorkType::IgnoredRpcBlock,
|
||||
Work::ChainSegment { .. } => WorkType::ChainSegment,
|
||||
@@ -825,6 +828,8 @@ impl<E: EthSpec> BeaconProcessor<E> {
|
||||
Some(item)
|
||||
} else if let Some(item) = work_queues.rpc_custody_column_queue.pop() {
|
||||
Some(item)
|
||||
} else if let Some(item) = work_queues.rpc_envelope_queue.pop() {
|
||||
Some(item)
|
||||
// Check delayed blocks before gossip blocks, the gossip blocks might rely
|
||||
// on the delayed ones.
|
||||
} else if let Some(item) = work_queues.delayed_block_queue.pop() {
|
||||
@@ -1192,6 +1197,9 @@ impl<E: EthSpec> BeaconProcessor<E> {
|
||||
work_queues.rpc_block_queue.push(work, work_id)
|
||||
}
|
||||
Work::RpcBlobs { .. } => work_queues.rpc_blob_queue.push(work, work_id),
|
||||
Work::RpcEnvelope(_) => {
|
||||
work_queues.rpc_envelope_queue.push(work, work_id)
|
||||
}
|
||||
Work::RpcCustodyColumn { .. } => {
|
||||
work_queues.rpc_custody_column_queue.push(work, work_id)
|
||||
}
|
||||
@@ -1330,6 +1338,7 @@ impl<E: EthSpec> BeaconProcessor<E> {
|
||||
WorkType::RpcBlobs | WorkType::IgnoredRpcBlock => {
|
||||
work_queues.rpc_blob_queue.len()
|
||||
}
|
||||
WorkType::RpcEnvelope => work_queues.rpc_envelope_queue.len(),
|
||||
WorkType::RpcCustodyColumn => work_queues.rpc_custody_column_queue.len(),
|
||||
WorkType::ColumnReconstruction => {
|
||||
work_queues.column_reconstruction_queue.len()
|
||||
@@ -1523,6 +1532,7 @@ impl<E: EthSpec> BeaconProcessor<E> {
|
||||
}
|
||||
| Work::RpcBlobs { process_fn }
|
||||
| Work::RpcCustodyColumn(process_fn)
|
||||
| Work::RpcEnvelope(process_fn)
|
||||
| Work::ColumnReconstruction(process_fn) => task_spawner.spawn_async(process_fn),
|
||||
Work::IgnoredRpcBlock { process_fn } => task_spawner.spawn_blocking(process_fn),
|
||||
Work::GossipBlock(work)
|
||||
|
||||
@@ -120,6 +120,7 @@ pub struct BeaconProcessorQueueLengths {
|
||||
rpc_block_queue: usize,
|
||||
rpc_blob_queue: usize,
|
||||
rpc_custody_column_queue: usize,
|
||||
rpc_envelope_queue: usize,
|
||||
column_reconstruction_queue: usize,
|
||||
chain_segment_queue: usize,
|
||||
backfill_chain_segment: usize,
|
||||
@@ -195,6 +196,8 @@ impl BeaconProcessorQueueLengths {
|
||||
// We don't request more than `PARENT_DEPTH_TOLERANCE` (32) lookups, so we can limit
|
||||
// this queue size. With 48 max blobs per block, each column sidecar list could be up to 12MB.
|
||||
rpc_custody_column_queue: 64,
|
||||
// Bounded by `PARENT_DEPTH_TOLERANCE`; one envelope per Gloas block.
|
||||
rpc_envelope_queue: 1024,
|
||||
column_reconstruction_queue: 1,
|
||||
chain_segment_queue: 64,
|
||||
backfill_chain_segment: 64,
|
||||
@@ -253,6 +256,7 @@ pub struct WorkQueues<E: EthSpec> {
|
||||
pub rpc_block_queue: FifoQueue<Work<E>>,
|
||||
pub rpc_blob_queue: FifoQueue<Work<E>>,
|
||||
pub rpc_custody_column_queue: FifoQueue<Work<E>>,
|
||||
pub rpc_envelope_queue: FifoQueue<Work<E>>,
|
||||
pub column_reconstruction_queue: LifoQueue<Work<E>>,
|
||||
pub chain_segment_queue: FifoQueue<Work<E>>,
|
||||
pub backfill_chain_segment: FifoQueue<Work<E>>,
|
||||
@@ -323,6 +327,7 @@ impl<E: EthSpec> WorkQueues<E> {
|
||||
let rpc_block_queue = FifoQueue::new(queue_lengths.rpc_block_queue);
|
||||
let rpc_blob_queue = FifoQueue::new(queue_lengths.rpc_blob_queue);
|
||||
let rpc_custody_column_queue = FifoQueue::new(queue_lengths.rpc_custody_column_queue);
|
||||
let rpc_envelope_queue = FifoQueue::new(queue_lengths.rpc_envelope_queue);
|
||||
let column_reconstruction_queue = LifoQueue::new(queue_lengths.column_reconstruction_queue);
|
||||
let chain_segment_queue = FifoQueue::new(queue_lengths.chain_segment_queue);
|
||||
let backfill_chain_segment = FifoQueue::new(queue_lengths.backfill_chain_segment);
|
||||
@@ -391,6 +396,7 @@ impl<E: EthSpec> WorkQueues<E> {
|
||||
rpc_block_queue,
|
||||
rpc_blob_queue,
|
||||
rpc_custody_column_queue,
|
||||
rpc_envelope_queue,
|
||||
chain_segment_queue,
|
||||
column_reconstruction_queue,
|
||||
backfill_chain_segment,
|
||||
|
||||
Reference in New Issue
Block a user