diff --git a/Cargo.toml b/Cargo.toml index 712c0db..297ef5c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ members = ["crates/*"] resolver = "2" [workspace.package] -version = "0.16.0-rc.8" +version = "0.16.0-rc.9" edition = "2024" rust-version = "1.88" authors = ["init4"] @@ -34,15 +34,15 @@ debug = false incremental = false [workspace.dependencies] -signet-blobber = { version = "0.16.0-rc.8", path = "crates/blobber" } -signet-block-processor = { version = "0.16.0-rc.8", path = "crates/block-processor" } -signet-db = { version = "0.16.0-rc.8", path = "crates/db" } -signet-genesis = { version = "0.16.0-rc.8", path = "crates/genesis" } -signet-node = { version = "0.16.0-rc.8", path = "crates/node" } -signet-node-config = { version = "0.16.0-rc.8", path = "crates/node-config" } -signet-node-tests = { version = "0.16.0-rc.8", path = "crates/node-tests" } -signet-node-types = { version = "0.16.0-rc.8", path = "crates/node-types" } -signet-rpc = { version = "0.16.0-rc.8", path = "crates/rpc" } +signet-blobber = { version = "0.16.0-rc.9", path = "crates/blobber" } +signet-block-processor = { version = "0.16.0-rc.9", path = "crates/block-processor" } +signet-db = { version = "0.16.0-rc.9", path = "crates/db" } +signet-genesis = { version = "0.16.0-rc.9", path = "crates/genesis" } +signet-node = { version = "0.16.0-rc.9", path = "crates/node" } +signet-node-config = { version = "0.16.0-rc.9", path = "crates/node-config" } +signet-node-tests = { version = "0.16.0-rc.9", path = "crates/node-tests" } +signet-node-types = { version = "0.16.0-rc.9", path = "crates/node-types" } +signet-rpc = { version = "0.16.0-rc.9", path = "crates/rpc" } init4-bin-base = { version = "0.18.0-rc.8", features = ["alloy"] } diff --git a/crates/node-config/src/core.rs b/crates/node-config/src/core.rs index 4656c85..08a2959 100644 --- a/crates/node-config/src/core.rs +++ b/crates/node-config/src/core.rs @@ -12,6 +12,7 @@ use std::{ fmt::Display, path::PathBuf, sync::{Arc, OnceLock}, + time::Duration, }; use tracing::warn; use trevm::revm::primitives::hardfork::SpecId; @@ -72,6 +73,15 @@ pub struct SignetNodeConfig { optional )] backfill_max_blocks: Option, + + /// Maximum duration of a backfill batch. + /// This prevents MDBX from killing the read transaction, leading to a crash if reth's default mdbx read transaction timeout is exceeded. + #[from_env( + var = "BACKFILL_MAX_DURATION", + desc = "Maximum duration of a backfill batch, in seconds", + optional + )] + backfill_max_duration: Option, } impl Display for SignetNodeConfig { @@ -105,6 +115,7 @@ impl SignetNodeConfig { genesis, slot_calculator, backfill_max_blocks: None, // Uses default of 10,000 via accessor + backfill_max_duration: None, // Uses default of 30 seconds via accessor } } @@ -252,6 +263,12 @@ impl SignetNodeConfig { // Default to 10,000 if not explicitly configured Some(self.backfill_max_blocks.unwrap_or(10_000)) } + + /// Get the maximum duration of a backfill batch. + /// Returns `Some(30)` seconds by default if not configured. + pub fn backfill_max_duration(&self) -> Option { + Some(Duration::from_secs(self.backfill_max_duration.unwrap_or(30))) + } } #[cfg(test)] @@ -272,6 +289,7 @@ mod defaults { genesis: GenesisSpec::Known(KnownChains::Test), slot_calculator: SlotCalculator::new(0, 0, 12), backfill_max_blocks: None, // Uses default of 10,000 via accessor + backfill_max_duration: None, // Uses default of 30 seconds via accessor } } } diff --git a/crates/node/src/node.rs b/crates/node/src/node.rs index 8b4ed05..4b5ac4f 100644 --- a/crates/node/src/node.rs +++ b/crates/node/src/node.rs @@ -299,13 +299,14 @@ where /// This should be called after `set_with_head` to configure how many /// blocks can be processed per backfill batch. fn set_backfill_thresholds(&mut self) { - if let Some(max_blocks) = self.config.backfill_max_blocks() { - self.host.notifications.set_backfill_thresholds(ExecutionStageThresholds { - max_blocks: Some(max_blocks), - ..Default::default() - }); - debug!(max_blocks, "configured backfill thresholds"); - } + let max_blocks = self.config.backfill_max_blocks(); + let max_duration = self.config.backfill_max_duration(); + self.host.notifications.set_backfill_thresholds(ExecutionStageThresholds { + max_blocks, + max_duration, + ..Default::default() + }); + debug!(?max_blocks, ?max_duration, "configured backfill thresholds"); } /// Runs on any notification received from the ExEx context.