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
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ For more details on each flag, see the inline help (`kona-node node --help`) or
| `--l1-beacon <URL>` | `KONA_NODE_L1_BEACON` | URL of the L1 beacon API | Yes | - |
| `--l2-engine-rpc <URL>` | `KONA_NODE_L2_ENGINE_RPC` | URL of the engine API endpoint of an L2 execution client | Yes | - |
| `--l2-engine-jwt-secret <PATH>` | `KONA_NODE_L2_ENGINE_AUTH` | Path to file containing the hex-encoded JWT secret for the execution client | No | - |
| `--l2-el-sync-stall-timeout <SECONDS>` | `KONA_NODE_L2_EL_SYNC_STALL_TIMEOUT` | How long to wait for a missing derived block while the execution client answers `SYNCING` and neither its reported sync progress nor its latest block moves, before resetting. Execution clients report no progress while they download headers, which can take hours | No | `86400` |
| `--l2-config-file <PATH>` | `KONA_NODE_ROLLUP_CONFIG` | Path to a custom L2 rollup configuration file | No | - |
| `--l1-runtime-config-reload-interval <SECONDS>` | `KONA_NODE_L1_RUNTIME_CONFIG_RELOAD_INTERVAL` | Poll interval for reloading runtime config | No | `600` |

Expand Down
8 changes: 6 additions & 2 deletions rust/kona/bin/node/src/commands/node/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,12 @@ impl NodeCommand {
let p2p_config = self.p2p_flags.clone().config(&cfg, args, Some(&l1_provider)).await?;
let rpc_config = self.rpc_flags.clone().into();

let engine_config =
EngineConfig { config: Arc::new(cfg.clone()), mode: self.node_mode, provider: engine };
let engine_config = EngineConfig {
config: Arc::new(cfg.clone()),
el_sync_stall_timeout: self.l2_client_args.el_sync_stall_timeout(),
mode: self.node_mode,
provider: engine,
};

let dependency_set = self.load_dependency_set(&cfg)?;
let safe_db = self.open_safe_db()?;
Expand Down
37 changes: 35 additions & 2 deletions rust/kona/bin/node/src/flags/engine/providers.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use alloy_rpc_types_engine::JwtSecret;
use std::path::PathBuf;
use kona_engine::DEFAULT_EL_SYNC_STALL_TIMEOUT;
use std::{path::PathBuf, time::Duration};
use url::Url;

const DEFAULT_L2_ENGINE_TIMEOUT: u64 = 30_000;
const DEFAULT_L1_TRUST_RPC: bool = false;
const DEFAULT_L2_EL_SYNC_STALL_TIMEOUT: u64 = DEFAULT_EL_SYNC_STALL_TIMEOUT.as_secs();
const DEFAULT_L2_ENGINE_TIMEOUT: u64 = 30_000;

/// L1 client arguments.
#[derive(Clone, Debug, clap::Args)]
Expand Down Expand Up @@ -73,6 +75,22 @@ pub struct L2ClientArgs {
default_value_t = DEFAULT_L2_ENGINE_TIMEOUT
)]
pub l2_engine_timeout: u64,
/// Seconds to wait for a missing derived block while the execution layer answers `SYNCING`
/// and neither its reported sync progress nor its latest block moves, before resetting.
#[arg(
long,
visible_alias = "l2.el-sync-stall-timeout",
env = "KONA_NODE_L2_EL_SYNC_STALL_TIMEOUT",
default_value_t = DEFAULT_L2_EL_SYNC_STALL_TIMEOUT
)]
pub l2_el_sync_stall_timeout: u64,
}

impl L2ClientArgs {
/// How long a consolidation waits for an execution layer whose sync reports no progress.
pub const fn el_sync_stall_timeout(&self) -> Duration {
Duration::from_secs(self.l2_el_sync_stall_timeout)
}
}

impl Default for L2ClientArgs {
Expand All @@ -82,6 +100,7 @@ impl Default for L2ClientArgs {
l2_engine_jwt_secret: None,
l2_engine_jwt_encoded: None,
l2_engine_timeout: DEFAULT_L2_ENGINE_TIMEOUT,
l2_el_sync_stall_timeout: DEFAULT_L2_EL_SYNC_STALL_TIMEOUT,
}
}
}
Expand Down Expand Up @@ -136,6 +155,20 @@ mod tests {
assert_eq!(parsed.l1.l1_trust_rpc, l1);
}

#[rstest]
#[case::default(&[], DEFAULT_EL_SYNC_STALL_TIMEOUT)]
#[case::dotted_alias(&["--l2.el-sync-stall-timeout=600"], Duration::from_secs(600))]
#[case::long_flag(&["--l2-el-sync-stall-timeout", "7200"], Duration::from_secs(7200))]
fn test_parse_el_sync_stall_timeout(#[case] flags: &[&str], #[case] expected: Duration) {
// Keep these CLI/default tests independent of the operator's environment.
let command =
ClientArgs::command().mut_arg("l2_el_sync_stall_timeout", |arg| arg.env(None::<&str>));
let args = [CLIENT_ARGS, flags].concat();
let matches = command.try_get_matches_from(args).unwrap();
let parsed = ClientArgs::from_arg_matches(&matches).unwrap();
assert_eq!(parsed.l2.el_sync_stall_timeout(), expected);
}

#[test]
fn test_default_l1_trust_rpc() {
assert!(!L1ClientArgs::default().l1_trust_rpc);
Expand Down
8 changes: 4 additions & 4 deletions rust/kona/crates/node/engine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ extern crate tracing;
mod task_queue;
pub use task_queue::{
BuildTask, BuildTaskError, CanonicalizeTask, CanonicalizeTaskError, ConsolidateInput,
ConsolidateTask, ConsolidateTaskError, Engine, EngineBuildError, EngineResetError, EngineTask,
EngineTaskError, EngineTaskErrorSeverity, EngineTaskErrors, ExecutableEngineTask,
FinalizeBlockId, FinalizeTask, FinalizeTaskError, InsertTask, InsertTaskError, SealTask,
SealTaskError, SynchronizeTaskError,
ConsolidateTask, ConsolidateTaskError, DEFAULT_EL_SYNC_STALL_TIMEOUT, DrainScope, Engine,
EngineBuildError, EngineResetError, EngineTask, EngineTaskError, EngineTaskErrorSeverity,
EngineTaskErrors, ExecutableEngineTask, FinalizeBlockId, FinalizeTask, FinalizeTaskError,
InsertTask, InsertTaskError, SealTask, SealTaskError, SynchronizeTaskError,
};

mod attributes;
Expand Down
Loading
Loading