Skip to content

Commit 36260c6

Browse files
authored
feat: overwrite reth default cache directory (#238)
* feat: overwrite reth default cache directory * doc: logs path
1 parent 95b420a commit 36260c6

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ To enable metrics, set the `--metrics` flag like in [reth](https://reth.rs/run/m
9393

9494
To see the full list of op-rbuilder metrics, see [`src/metrics.rs`](./crates/op-rbuilder/src/metrics.rs).
9595

96+
Default `debug` level trace logs can be found at:
97+
98+
- `~/.cache/op-rbuilder/logs` on Linux
99+
- `~/Library/Caches/op-rbuilder/logs` on macOS
100+
- `%localAppData%/op-rbuilder/logs` on Windows
101+
96102
## Integration Testing
97103

98104
op-rbuilder has an integration test framework that runs the builder against mock engine api payloads and ensures that the builder produces valid blocks.

crates/op-rbuilder/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ ctor = { version = "0.4.2", optional = true }
136136
rlimit = { version = "0.10", optional = true }
137137
macros = { path = "src/tests/framework/macros", optional = true }
138138
testcontainers = "0.24.0"
139+
dirs-next = "2.0.0"
139140

140141
[target.'cfg(unix)'.dependencies]
141142
tikv-jemallocator = { version = "0.6", optional = true }

crates/op-rbuilder/src/args/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,17 @@ impl CliExt for Cli {
7878

7979
/// Parses commands and overrides versions
8080
fn set_version() -> Self {
81+
let logs_dir = dirs_next::cache_dir()
82+
.map(|root| root.join("op-rbuilder/logs"))
83+
.unwrap()
84+
.into_os_string();
8185
let matches = Cli::command()
8286
.version(SHORT_VERSION)
8387
.long_version(LONG_VERSION)
8488
.about("Block builder designed for the Optimism stack")
8589
.author("Flashbots")
8690
.name("op-rbuilder")
91+
.mut_arg("log_file_directory", |arg| arg.default_value(logs_dir))
8792
.get_matches();
8893
Cli::from_arg_matches(&matches).expect("Parsing args")
8994
}

0 commit comments

Comments
 (0)