Skip to content

Commit 4988dbc

Browse files
feat: skip slot when slot info fetching takes too long (#775)
* feat: skip slot when slot info fetching takes too long * Update cargo-deny installation command --------- Co-authored-by: Anish M Gehlot <[email protected]>
1 parent 0e8c6e4 commit 4988dbc

File tree

3 files changed

+29
-8
lines changed

3 files changed

+29
-8
lines changed

Cargo.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ resolver = "2"
1212
default-members = ["node"]
1313

1414
[workspace.package]
15-
version = "1.24.3"
15+
version = "1.24.4"
1616
edition = "2024"
1717
repository = "https://github.com/NethermindEth/Catalyst"
1818
license = "MIT"

pacaya/src/node/mod.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,11 +493,16 @@ impl Node {
493493
async fn get_slot_info_and_status(
494494
&mut self,
495495
) -> Result<(L2SlotInfo, OperatorStatus, Option<PreBuiltTxList>), Error> {
496+
let start = std::time::Instant::now();
496497
let l2_slot_info = self.taiko.get_l2_slot_info().await;
498+
let elapsed_l2_slot = start.elapsed();
499+
497500
let current_status = match &l2_slot_info {
498501
Ok(info) => self.operator.get_status(info).await,
499502
Err(_) => Err(anyhow::anyhow!("Failed to get L2 slot info")),
500503
};
504+
let elapsed_status = start.elapsed();
505+
501506
let batches_ready_to_send = self.batch_manager.get_number_of_batches_ready_to_send();
502507
let pending_tx_list = match &l2_slot_info {
503508
Ok(info) => {
@@ -507,13 +512,29 @@ impl Node {
507512
}
508513
Err(_) => Err(anyhow::anyhow!("Failed to get L2 slot info")),
509514
};
515+
let elapsed_pending_tx = start.elapsed();
516+
510517
self.print_current_slots_info(
511518
&current_status,
512519
&pending_tx_list,
513520
&l2_slot_info,
514521
self.batch_manager.get_number_of_batches(),
515522
)?;
516523

524+
if elapsed_pending_tx.as_millis() > (self.config.preconf_heartbeat_ms / 2).into() {
525+
error!(
526+
"Critical error: getting slot info and status is taking too long: total {} ms (l2_slot_info: {} ms, status: {} ms, pending_tx_list: {} ms)",
527+
elapsed_pending_tx.as_millis(),
528+
elapsed_l2_slot.as_millis(),
529+
(elapsed_status - elapsed_l2_slot).as_millis(),
530+
(elapsed_pending_tx - elapsed_status).as_millis()
531+
);
532+
self.metrics.inc_critical_errors();
533+
return Err(anyhow::anyhow!(
534+
"Getting slot info and status is taking too long"
535+
));
536+
}
537+
517538
Ok((l2_slot_info?, current_status?, pending_tx_list?))
518539
}
519540

0 commit comments

Comments
 (0)