From 63ef54c39ac82e96f9342fca7cee852c80c76a66 Mon Sep 17 00:00:00 2001 From: Pablo Deymonnaz Date: Wed, 25 Mar 2026 16:15:02 -0300 Subject: [PATCH 1/4] Add --data-dir CLI parameter for configuring RocksDB storage path Defaults to ./data for backward compatibility. Matches the same parameter available in other lean clients like Zeam. --- bin/ethlambda/src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/ethlambda/src/main.rs b/bin/ethlambda/src/main.rs index 1b145d9..d3525cc 100644 --- a/bin/ethlambda/src/main.rs +++ b/bin/ethlambda/src/main.rs @@ -69,6 +69,9 @@ struct CliOptions { /// Number of attestation committees (subnets) per slot #[arg(long, default_value = "1", value_parser = clap::value_parser!(u64).range(1..))] attestation_committee_count: u64, + /// Directory for RocksDB storage + #[arg(long, default_value = "./data")] + data_dir: PathBuf, } #[tokio::main] @@ -130,7 +133,9 @@ async fn main() -> eyre::Result<()> { let validator_keys = read_validator_keys(&validators_path, &validator_keys_dir, &options.node_id); - let backend = Arc::new(RocksDBBackend::open("./data").expect("Failed to open RocksDB")); + let backend = Arc::new( + RocksDBBackend::open(&options.data_dir).expect("Failed to open RocksDB"), + ); let store = fetch_initial_state( options.checkpoint_sync_url.as_deref(), From a4e2f4a76da8149d115179c37223b3b28a393f71 Mon Sep 17 00:00:00 2001 From: Pablo Deymonnaz Date: Wed, 25 Mar 2026 16:23:44 -0300 Subject: [PATCH 2/4] Fix formatting for RocksDBBackend::open call --- bin/ethlambda/src/main.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/ethlambda/src/main.rs b/bin/ethlambda/src/main.rs index d3525cc..37e0fdd 100644 --- a/bin/ethlambda/src/main.rs +++ b/bin/ethlambda/src/main.rs @@ -133,9 +133,8 @@ async fn main() -> eyre::Result<()> { let validator_keys = read_validator_keys(&validators_path, &validator_keys_dir, &options.node_id); - let backend = Arc::new( - RocksDBBackend::open(&options.data_dir).expect("Failed to open RocksDB"), - ); + let backend = + Arc::new(RocksDBBackend::open(&options.data_dir).expect("Failed to open RocksDB")); let store = fetch_initial_state( options.checkpoint_sync_url.as_deref(), From 620183b8a639992db5effd9f0623bb33ca459209 Mon Sep 17 00:00:00 2001 From: Pablo Deymonnaz Date: Wed, 25 Mar 2026 16:25:19 -0300 Subject: [PATCH 3/4] Create parent directories before opening RocksDB and log the data path Addresses review feedback: create_dir_all prevents cryptic RocksDB errors when parent directories don't exist, and logging the resolved path helps diagnose misconfiguration in server deployments. --- bin/ethlambda/src/main.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/ethlambda/src/main.rs b/bin/ethlambda/src/main.rs index 37e0fdd..4de205c 100644 --- a/bin/ethlambda/src/main.rs +++ b/bin/ethlambda/src/main.rs @@ -133,8 +133,10 @@ async fn main() -> eyre::Result<()> { let validator_keys = read_validator_keys(&validators_path, &validator_keys_dir, &options.node_id); + std::fs::create_dir_all(&options.data_dir).expect("Failed to create data directory"); let backend = Arc::new(RocksDBBackend::open(&options.data_dir).expect("Failed to open RocksDB")); + info!(data_dir = %options.data_dir.display(), "Opened storage"); let store = fetch_initial_state( options.checkpoint_sync_url.as_deref(), From c563d0f0f3ef751f4e7285f53d1ef715d2f75e8b Mon Sep 17 00:00:00 2001 From: Pablo Deymonnaz Date: Wed, 25 Mar 2026 16:26:35 -0300 Subject: [PATCH 4/4] Rename storage log message to "Initialized DB" --- bin/ethlambda/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ethlambda/src/main.rs b/bin/ethlambda/src/main.rs index 4de205c..f026068 100644 --- a/bin/ethlambda/src/main.rs +++ b/bin/ethlambda/src/main.rs @@ -136,7 +136,7 @@ async fn main() -> eyre::Result<()> { std::fs::create_dir_all(&options.data_dir).expect("Failed to create data directory"); let backend = Arc::new(RocksDBBackend::open(&options.data_dir).expect("Failed to open RocksDB")); - info!(data_dir = %options.data_dir.display(), "Opened storage"); + info!(data_dir = %options.data_dir.display(), "Initialized DB"); let store = fetch_initial_state( options.checkpoint_sync_url.as_deref(),