Add --data-dir CLI parameter for configuring storage path#248
Add --data-dir CLI parameter for configuring storage path#248pablodeymo merged 4 commits intomainfrom
Conversation
Defaults to ./data for backward compatibility. Matches the same parameter available in other lean clients like Zeam.
🤖 Kimi Code ReviewThe changes look correct and follow Rust best practices. This is a straightforward configuration improvement with no security or correctness issues. Summary:
Review:
Minor suggestions (non-blocking):
Security note: As with all database path configurations, operators should ensure proper filesystem permissions on the target directory to prevent unauthorized access to validator state or chain data. LGTM. Automated review by Kimi (Moonshot AI) · kimi-k2.5 · custom prompt |
🤖 Claude Code ReviewThe change is minimal and clean. Here's the review: PR #248: Add
|
🤖 Codex Code ReviewNo findings. This PR is a straightforward CLI plumbing change: it adds I could not run Automated review by OpenAI Codex · gpt-5.4 · custom prompt |
Greptile SummaryThis PR adds a Key changes:
Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| bin/ethlambda/src/main.rs | Adds --data-dir CLI argument (defaulting to ./data) to CliOptions, calls create_dir_all before opening RocksDB to handle missing parent directories, and logs the resolved path at startup. All previous review concerns are fully addressed. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A([ethlambda start]) --> B[Parse CLI options\n--data-dir or default ./data]
B --> C{data_dir provided?}
C -- yes --> D[Use provided path]
C -- no --> E[Use default ./data]
D --> F[std::fs::create_dir_all\ndata_dir]
E --> F
F --> G{Directory created\nor already exists?}
G -- failure --> H([panic: Failed to create\ndata directory])
G -- success --> I[RocksDBBackend::open\ndata_dir]
I --> J{Open succeeded?}
J -- failure --> K([panic: Failed to open RocksDB])
J -- success --> L[info! Initialized DB\ndata_dir = ...]
L --> M[Continue node startup...]
Reviews (2): Last reviewed commit: "Rename storage log message to "Initializ..." | Re-trigger Greptile
MegaRedHand
left a comment
There was a problem hiding this comment.
LGTM. greptile comments are on-point
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.
|
@greptile-apps review it again |
Motivation
The RocksDB storage path was hardcoded to
./data, making it impossible to configure where the node stores its data on disk. Other lean clients (e.g., Zeam) already expose a--data-dirparameter for this purpose.This is especially important for:
Description
--data-dirCLI argument toCliOptions(type:PathBuf, default:./data)"./data"string inRocksDBBackend::open()with the CLI-provided value--data-dirget the same./datadefaultUsage
CLI help output
--data-dir./dataFiles changed
bin/ethlambda/src/main.rs— new CLI arg + use it when opening RocksDBHow to Test
--data-dir→ data is stored in./data(no behavior change)--data-dir /tmp/test-data→ data is stored in/tmp/test-data--helpshows the new flagRelated Issues
Closes #79