-
Notifications
You must be signed in to change notification settings - Fork 247
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
[Bug] DebugApi problem #657
Comments
could you please prepare a serde roundtrip test for the given |
Not really sure about proper serialization in both cases.
|
I guess I found out what is wrong in bth cases : debug_traceBlockByNumber should have encoded block number in hexadecimal form with 0x prefix like : and I believe both debug_traceBlockByNumber and debug_traceBlockByHash return not Vec<GethTrace> but Vec<GethTraceResponse> where :
Hope that will help |
@dexloom I could not reproduce the issue with the latest master version. Did I got the code right? Could you have a look again? My example: use alloy_primitives::b256;
use alloy_provider::{ext::DebugApi, ProviderBuilder};
use alloy_rpc_types_trace::geth::{
GethDebugBuiltInTracerType, GethDebugTracerConfig, GethDebugTracerType, GethDebugTracingOptions, GethDefaultTracingOptions, GethTrace,
PreStateConfig, TraceResult,
};
#[tokio::main]
async fn main() {
let url = std::env::var("ETH_MAINNET_HTTP").expect("$ETH_MAINNET_HTTP must be set.");
let node_url = url::Url::parse(url.as_str()).unwrap();
let provider = ProviderBuilder::new().on_http(node_url);
let tracer_opts = GethDebugTracingOptions {
tracer: Some(GethDebugTracerType::BuiltInTracer(GethDebugBuiltInTracerType::PreStateTracer)),
config: GethDefaultTracingOptions::default().disable_storage().disable_stack().disable_memory().disable_return_data(),
timeout: None,
tracer_config: GethDebugTracerConfig::default(),
}
.with_prestate_config(PreStateConfig { diff_mode: Some(true) });
// CASE: by hash
let trace_results = provider
.debug_trace_block_by_hash(b256!("1b9f245b55515d17fd5b3467bfe595670c9599b3d54837cd32cfde5e2e667830"), tracer_opts)
.await
.unwrap();
// CASE: by number
//let trace_results = provider.debug_trace_block_by_number(BlockNumberOrTag::Number(19780651), tracer_opts).await.unwrap();
for trace_result in trace_results {
match trace_result {
TraceResult::Success { tx_hash, result } => match result {
GethTrace::Default(_) => {}
GethTrace::CallTracer(_) => {}
GethTrace::FourByteTracer(_) => {}
GethTrace::PreStateTracer(_) => {
println!("PreState trace: {:?}", tx_hash);
}
GethTrace::NoopTracer(_) => {}
GethTrace::MuxTracer(_) => {}
GethTrace::JS(_) => {
println!("JS trace: {:?}", tx_hash);
}
},
TraceResult::Error { .. } => {}
}
}
} |
Component
network, json-rpc
What version of Alloy are you on?
rev = "5a5f29e"
Operating System
None
Describe the bug
The following code returns :"server returned an error response: error code -32602: Invalid params"
in case debug_trace_block_by_number is used, most likely block number is encoded incorrectly,
and client.debug_trace_block_by_hash returns VecGethTrace::JS instead of VecGethTrace::PreStateTracer
client.debug_trace_call seems to be working well
The text was updated successfully, but these errors were encountered: