-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
debug_backtraceAt #4232
debug_backtraceAt #4232
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ reth-tasks.workspace = true | |
reth-metrics.workspace = true | ||
reth-consensus-common = { path = "../../consensus/common" } | ||
reth-rpc-types-compat.workspace = true | ||
lazy_static = "*" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove |
||
|
||
# eth | ||
revm = { workspace = true, features = [ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,12 @@ use std::sync::Arc; | |
use tokio::sync::{mpsc, AcquireError, OwnedSemaphorePermit}; | ||
use tokio_stream::{wrappers::ReceiverStream, StreamExt}; | ||
|
||
use lazy_static::lazy_static; | ||
use std::sync::Mutex; | ||
lazy_static! { | ||
static ref LOCATION: Mutex<String> = Mutex::new(String::new()); | ||
static ref BACKTRACE_ENABLED: Mutex<bool> = Mutex::new(false); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't want to support this atm so this function should just return unimplemented |
||
/// `debug` API implementation. | ||
/// | ||
/// This type provides the functionality for handling `debug` related requests. | ||
|
@@ -643,6 +649,34 @@ where | |
Ok(res.into()) | ||
} | ||
|
||
async fn debug_backtrace_at(&self, location: &str) -> RpcResult<()> { | ||
let mut parts: Vec<&str> = location.split(':').collect(); | ||
if parts.len() != 2 { | ||
return Err(internal_rpc_err("Invalid location format".to_string())) | ||
} | ||
parts[0] = parts[0].trim(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see above |
||
parts[1] = parts[1].trim(); | ||
|
||
if parts[0].is_empty() || parts[1].is_empty() { | ||
return Err(internal_rpc_err("Invalid location format".to_string())) | ||
} | ||
if !parts[0].ends_with(".rust") { | ||
return Err(internal_rpc_err("Invalid location format".to_string())) | ||
} | ||
|
||
if parts[1].parse::<i32>().is_err() { | ||
return Err(internal_rpc_err("Invalid location format".to_string())) | ||
} | ||
|
||
let mut location_lock = LOCATION.lock().unwrap(); | ||
*location_lock = location.to_string(); | ||
|
||
let mut backtrace_enabled_lock = BACKTRACE_ENABLED.lock().unwrap(); | ||
*backtrace_enabled_lock = !location.is_empty(); | ||
|
||
Ok(()) | ||
} | ||
|
||
/// Handler for `debug_getRawBlock` | ||
async fn raw_block(&self, block_id: BlockId) -> RpcResult<Bytes> { | ||
let block = self.inner.provider.block_by_id(block_id).to_rpc_result()?; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.