Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,14 @@ pub struct BuilderConfig {
)]
pub max_host_gas_coefficient: Option<u8>,

/// Number of seconds before the end of the slot to stop querying for new blocks
#[from_env(
var = "BLOCK_QUERY_CUTOFF_BUFFER",
desc = "Number of seconds before the end of the slot to stop querying for new blocks",
default = 2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default should be 3

)]
pub block_query_cutoff_buffer: u64,

/// The slot calculator for the builder.
pub slot_calculator: SlotCalculator,

Expand Down
3 changes: 2 additions & 1 deletion src/tasks/block/sim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,8 @@ impl Simulator {
// We have the timepoint in seconds into the slot. To find out what's
// remaining, we need to subtract it from the slot duration
// we also subtract 3 seconds to account for the sequencer stopping signing.
let remaining = (self.slot_calculator().slot_duration() - timepoint).saturating_sub(3);
let remaining = (self.slot_calculator().slot_duration() - timepoint)
.saturating_sub(self.config.block_query_cutoff_buffer);

let deadline = Instant::now() + Duration::from_secs(remaining);
deadline.max(Instant::now())
Expand Down
1 change: 1 addition & 0 deletions src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ pub fn setup_test_config() -> Result<BuilderConfig> {
1740681556, // pecorino start timestamp as sane default
0, 1,
),
block_query_cutoff_buffer: 2,
max_host_gas_coefficient: Some(80),
constants: SignetSystemConstants::pecorino(),
};
Expand Down