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
25 changes: 21 additions & 4 deletions crates/op-rbuilder/src/builder/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use crate::{
};
use alloy_primitives::B256;
use eyre::WrapErr as _;
use futures::FutureExt;
use op_alloy_rpc_types_engine::OpFlashblockPayload;
use reth_chainspec::EthChainSpec;
use reth_node_api::PayloadBuilderError;
Expand Down Expand Up @@ -796,16 +797,32 @@ where
.map_err(|e| PayloadBuilderError::Other(e.into()))?;

let (tx, rx) = mpsc::channel((expected_flashblocks + 1) as usize);
tokio::spawn(
let scheduler_payload_id = fb_payload.payload_id;
let scheduler_task =
self.task_metrics
.flashblock_timer
.instrument(flashblock_scheduler.run(
tx,
payload_cancel.clone(),
fb_cancel,
fb_payload.payload_id,
)),
);
scheduler_payload_id,
));
let scheduler_metrics = self.builder_ctx.metrics.clone();

self.executor.spawn_task(async move {
if std::panic::AssertUnwindSafe(scheduler_task)
.catch_unwind()
.await
.is_err()
Comment on lines +812 to +816
{
scheduler_metrics.flashblock_scheduler_death.increment(1);
error!(
target: "payload_builder",
id = %scheduler_payload_id,
"Flashblock scheduler task panicked, no further flashblocks will be triggered for this payload",
);
}
});
Comment on lines +812 to +825

// State data was extracted in Phase 1 block scope above.
// We carry (CacheState, Option<TransitionState>) between iterations
Expand Down
3 changes: 3 additions & 0 deletions crates/op-rbuilder/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ pub struct OpRBuilderMetrics {
pub continuous_fee_improvement: Histogram,
/// Builds completed but not published due to resolved gate
pub flashblock_publish_suppressed_total: Counter,
/// Flashblock scheduler task ended abnormally (panicked) instead of
/// completing or being cancelled normally
pub flashblock_scheduler_death: Counter,
/// TODO: Use labels for these
/// Payload job ended because getPayload resolved
pub payload_job_cancellation_resolved: Counter,
Expand Down
Loading