-
Notifications
You must be signed in to change notification settings - Fork 795
Transaction tracing is broken on IPC transport. #558
Comments
Hmm, isn't the geth trace transaction endpoint called The rpc name is set here ethers-rs/ethers-providers/src/provider.rs Line 777 in dc3ac42
you could try to either patching this to async fn trace_transaction<M:Middleware>(provider: &Provider<M>, hash: H256) -> Result<Vec<Trace>, ProviderError> {
let hash = utils::serialize(&hash);
provider.request("debug_traceTransaction", vec![hash]).await
} |
Changed: ethers-rs/ethers-providers/src/provider.rs Line 775 in dc3ac42
into: /// Returns all traces of a given transaction
async fn trace_transaction(&self, hash: H256) -> Result<Vec<Trace>, ProviderError> {
let hash = utils::serialize(&hash);
self.request("debug_traceTransaction", vec![hash]).await
} It didn't completely solve the issue, as the response format differs from |
Geth's trace type differs from what is currently implemented in |
This is what QuickType has generated when provided with several outputs of extern crate serde_derive;
#[derive(Serialize, Deserialize)]
pub struct GethTrace {
failed: bool,
gas: i64,
#[serde(rename = "returnValue")]
return_value: String,
#[serde(rename = "structLogs")]
struct_logs: Vec<StructLog>,
}
#[derive(Serialize, Deserialize)]
pub struct StructLog {
depth: i64,
error: Option<String>,
gas: i64,
#[serde(rename = "gasCost")]
gas_cost: i64,
memory: Option<Vec<String>>,
op: String,
pc: i64,
stack: Vec<String>,
storage: Storage,
}
#[derive(Serialize, Deserialize)]
pub struct Storage {
#[serde(rename = "0000000000000000000000000000000000000000000000000000000000000004")]
the_0000000000000000000000000000000000000000000000000000000000000004: Option<String>,
#[serde(rename = "0000000000000000000000000000000000000000000000000000000000000006")]
the_0000000000000000000000000000000000000000000000000000000000000006: Option<String>,
#[serde(rename = "f652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f")]
f652222313_e28459528_d920_b65115_c16_c04_f3_efc82_aaedc97_be59_f3_f377_c0_d3_f: Option<String>,
#[serde(rename = "0000000000000000000000000000000000000000000000000000000000000003")]
the_0000000000000000000000000000000000000000000000000000000000000003: Option<String>,
#[serde(rename = "0000000000000000000000000000000000000000000000000000000000000005")]
the_0000000000000000000000000000000000000000000000000000000000000005: Option<String>,
#[serde(rename = "0000000000000000000000000000000000000000000000000000000000000007")]
the_0000000000000000000000000000000000000000000000000000000000000007: Option<String>,
#[serde(rename = "0000000000000000000000000000000000000000000000000000000000000008")]
the_0000000000000000000000000000000000000000000000000000000000000008: Option<String>,
#[serde(rename = "000000000000000000000000000000000000000000000000000000000000000c")]
the_000000000000000000000000000000000000000000000000000000000000000_c: Option<String>,
} Storage should probably be an HashMap |
since these are storage slots it probably should be
see also https://geth.ethereum.org/docs/rpc/ns-debug#debug_tracetransaction |
I hereby provide a somewhat detailed explanation of what happens when tracing transaction with geth on ipc transport:
Related to #562 . |
this seems like a reasonable assumption. Could you please dump the read_buffer to a json file after everytime it is extended and look at that? the way the streamserilizer works is, it skips whitespace and tries to deserialize a value then shift, repeat. |
I produced 2 dump files, namely, Doesn't seem to be an issue of correctness. I have a hunch that it may be socket-related. |
but the |
I don't think I understand your question. |
I see, so it appears that reading from the socket is exhausted before the trace object was fully read? |
Yeah! dumps.zip
Exactly. |
Version
Latest, pulled directly from the master branch of the repository.
Description
I will provide a brief explanation of what I saw from inserting
dbg!
around the codebase.It looks to me that the json response format for both
trace_transaction
andtrace_raw_transaction
is either one of the following:Long text
The following occurs, both for
trace_transaction
andtrace_raw_transaction
, when the client request is successful.EDIT: this one above is the response for
eth_getTransactionByHash
.These two occur when it fails. These failure are also suspicious as the same requests issued directly to the node (Geth) doesn't fail.
As a consequence of this,
serde_json
is never able to properly deserialise the first object into the types specified in the methods' signatures, namelyVec<Trace>
andBlockTrace
, and one of these two errors is always returned to the user.In case of a successful request issued with
trace_raw_transaction
, this parsing always fails with:Conversely, for
trace_transaction
:To reproduce this results you can use the following code:
and replace this line with:
I was also able to the problem up to here.
The text was updated successfully, but these errors were encountered: