From 011f4a8e5c2399a3f5cba635eddabd6a9d78e18d Mon Sep 17 00:00:00 2001 From: Alexey Shekhirin Date: Thu, 4 Jan 2024 15:12:15 +0000 Subject: [PATCH 1/2] feat(cli): enable backtrace on panic by default, unless manually set --- bin/reth/src/main.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/reth/src/main.rs b/bin/reth/src/main.rs index ea057ee6b30a..758682c4defe 100644 --- a/bin/reth/src/main.rs +++ b/bin/reth/src/main.rs @@ -9,6 +9,11 @@ compile_error!("Cannot build the `reth` binary with the `optimism` feature flag #[cfg(not(feature = "optimism"))] fn main() { + // Enable backtraces unless a RUST_BACKTRACE value has already been explicitly provided. + if std::env::var("RUST_BACKTRACE").is_err() { + std::env::set_var("RUST_BACKTRACE", "1"); + } + if let Err(err) = reth::cli::run() { eprintln!("Error: {err:?}"); std::process::exit(1); From 3d6b0f18dd5d8a1ab00bca7b3f6fd69a9eb48eed Mon Sep 17 00:00:00 2001 From: Alexey Shekhirin Date: Thu, 4 Jan 2024 17:20:29 +0000 Subject: [PATCH 2/2] add backtrace=1 for op-reth --- bin/reth/src/optimism.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/reth/src/optimism.rs b/bin/reth/src/optimism.rs index 89ba2dd840bf..dbd980b1e4d1 100644 --- a/bin/reth/src/optimism.rs +++ b/bin/reth/src/optimism.rs @@ -9,6 +9,11 @@ compile_error!("Cannot build the `op-reth` binary with the `optimism` feature fl #[cfg(feature = "optimism")] fn main() { + // Enable backtraces unless a RUST_BACKTRACE value has already been explicitly provided. + if std::env::var("RUST_BACKTRACE").is_err() { + std::env::set_var("RUST_BACKTRACE", "1"); + } + if let Err(err) = reth::cli::run() { eprintln!("Error: {err:?}"); std::process::exit(1);