Skip to content

Commit 9dab75e

Browse files
committed
fix: make block query cutoff properly configurable
1 parent 1159cbc commit 9dab75e

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

src/config.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,14 @@ pub struct BuilderConfig {
155155
)]
156156
pub max_host_gas_coefficient: Option<u8>,
157157

158+
/// Number of seconds before the end of the slot to stop querying for new blocks
159+
#[from_env(
160+
var ="BLOCK_QUERY_CUTOFF_SECS",
161+
desc = "Number of seconds before the end of the slot to stop querying for new blocks",
162+
default = 2
163+
)]
164+
pub block_query_cutoff_secs: u64,
165+
158166
/// The slot calculator for the builder.
159167
pub slot_calculator: SlotCalculator,
160168

src/tasks/block/sim.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ impl Simulator {
253253
// We have the timepoint in seconds into the slot. To find out what's
254254
// remaining, we need to subtract it from the slot duration
255255
// we also subtract 3 seconds to account for the sequencer stopping signing.
256-
let remaining = (self.slot_calculator().slot_duration() - timepoint).saturating_sub(3);
256+
let remaining = (self.slot_calculator().slot_duration() - timepoint).saturating_sub(self.config.block_query_cutoff_secs);
257257

258258
let deadline = Instant::now() + Duration::from_secs(remaining);
259259
deadline.max(Instant::now())

src/test_utils.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ pub fn setup_test_config() -> Result<BuilderConfig> {
5353
1740681556, // pecorino start timestamp as sane default
5454
0, 1,
5555
),
56+
block_query_cutoff_secs: 2,
5657
max_host_gas_coefficient: Some(80),
5758
constants: SignetSystemConstants::pecorino(),
5859
};

0 commit comments

Comments
 (0)