From 020d82bfe87e6e58dc99f05e4b1da03b33d5475d Mon Sep 17 00:00:00 2001 From: PoulavBhowmick03 Date: Wed, 17 Sep 2025 13:17:36 +0530 Subject: [PATCH 1/2] max reconstruction delay as a function of slot time --- .../src/scheduler/work_reprocessing_queue.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/beacon_node/beacon_processor/src/scheduler/work_reprocessing_queue.rs b/beacon_node/beacon_processor/src/scheduler/work_reprocessing_queue.rs index 8c33cf58693..79021744326 100644 --- a/beacon_node/beacon_processor/src/scheduler/work_reprocessing_queue.rs +++ b/beacon_node/beacon_processor/src/scheduler/work_reprocessing_queue.rs @@ -84,8 +84,9 @@ pub const BACKFILL_SCHEDULE_IN_SLOT: [(u32, u32); 3] = [ (4, 5), ]; -/// Trigger reconstruction if we are this many seconds into the current slot -pub const RECONSTRUCTION_DEADLINE: Duration = Duration::from_millis(3000); +/// Fraction of slot duration after which column reconstruction is triggered, makes it easier for +/// different slot timings to have a generalised deadline +pub const RECONSTRUCTION_DEADLINE: f64 = 0.25; /// Messages that the scheduler can receive. #[derive(AsRefStr)] @@ -756,13 +757,17 @@ impl ReprocessQueue { } InboundEvent::Msg(DelayColumnReconstruction(request)) => { let mut reconstruction_delay = QUEUED_RECONSTRUCTION_DELAY; + let slot_duration = self.slot_clock.slot_duration().as_millis() as f64; + let reconstruction_deadline_millis = + (slot_duration * RECONSTRUCTION_DEADLINE).floor() as u64; + let reconstruction_deadline = Duration::from_millis(reconstruction_deadline_millis); if let Some(seconds_from_current_slot) = self.slot_clock.seconds_from_current_slot_start() && let Some(current_slot) = self.slot_clock.now() - && seconds_from_current_slot >= RECONSTRUCTION_DEADLINE + && seconds_from_current_slot >= reconstruction_deadline && current_slot == request.slot { - // If we are at least `RECONSTRUCTION_DEADLINE` seconds into the current slot, + // If we are at least `reconstruction_deadline` seconds into the current slot, // and the reconstruction request is for the current slot, process reconstruction immediately. reconstruction_delay = Duration::from_secs(0); } From 9d896af35c565831a192f12ee3c33ef1d9e750ee Mon Sep 17 00:00:00 2001 From: PoulavBhowmick03 Date: Fri, 19 Sep 2025 23:14:18 +0530 Subject: [PATCH 2/2] removed float arithmatic and changed to integer --- .../src/scheduler/work_reprocessing_queue.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/beacon_node/beacon_processor/src/scheduler/work_reprocessing_queue.rs b/beacon_node/beacon_processor/src/scheduler/work_reprocessing_queue.rs index 79021744326..9ff26e78417 100644 --- a/beacon_node/beacon_processor/src/scheduler/work_reprocessing_queue.rs +++ b/beacon_node/beacon_processor/src/scheduler/work_reprocessing_queue.rs @@ -86,7 +86,7 @@ pub const BACKFILL_SCHEDULE_IN_SLOT: [(u32, u32); 3] = [ /// Fraction of slot duration after which column reconstruction is triggered, makes it easier for /// different slot timings to have a generalised deadline -pub const RECONSTRUCTION_DEADLINE: f64 = 0.25; +pub const RECONSTRUCTION_DEADLINE: (u64, u64) = (1, 4); /// Messages that the scheduler can receive. #[derive(AsRefStr)] @@ -757,9 +757,9 @@ impl ReprocessQueue { } InboundEvent::Msg(DelayColumnReconstruction(request)) => { let mut reconstruction_delay = QUEUED_RECONSTRUCTION_DELAY; - let slot_duration = self.slot_clock.slot_duration().as_millis() as f64; + let slot_duration = self.slot_clock.slot_duration().as_millis() as u64; let reconstruction_deadline_millis = - (slot_duration * RECONSTRUCTION_DEADLINE).floor() as u64; + (slot_duration * RECONSTRUCTION_DEADLINE.0) / RECONSTRUCTION_DEADLINE.1; let reconstruction_deadline = Duration::from_millis(reconstruction_deadline_millis); if let Some(seconds_from_current_slot) = self.slot_clock.seconds_from_current_slot_start()