Skip to content
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

fix: make Parity TraceResults output optional #1102

Merged
merged 2 commits into from
Jul 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions crates/rpc-types-trace/src/parity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub enum TraceType {
#[serde(rename_all = "camelCase")]
pub struct TraceResults {
/// Output of the trace
#[serde(deserialize_with = "alloy_serde::null_as_default")]
pub output: Bytes,
mattsse marked this conversation as resolved.
Show resolved Hide resolved
/// Enabled if [TraceType::StateDiff] is provided
pub state_diff: Option<StateDiff>,
Expand Down Expand Up @@ -821,4 +822,31 @@ mod tests {
let serialized = serde_json::to_string_pretty(&trace).unwrap();
similar_asserts::assert_eq!(serialized, reference_data);
}
#[test]
fn test_nethermind_trace_result_null_output_value() {
let reference_data = r#"{
"output": null,
Comment on lines +826 to +828
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a nethermind issue for this, I want to understand when this can be null to rule out something we may have missed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, I didn't dig very deeply, but it seems that vm_trace can also be null.

"stateDiff": {
"0x5e1d1eb61e1164d5a50b28c575da73a29595dff7": {
"balance": "=",
"code": "=",
"nonce": "=",
"storage": {
"0x0000000000000000000000000000000000000000000000000000000000000005": {
"*": {
"from": "0x0000000000000000000000000000000000000000000000000000000000042f66",
"to": "0x0000000000000000000000000000000000000000000000000000000000042f67"
}
}
}
}
},
"trace": [],
"vmTrace": null,
"transactionHash": "0xe56a5e7455c45b1842b35dbcab9d024b21870ee59820525091e183b573b4f9eb"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a real transaction?
wasn't able to find it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}"#;
let trace =
serde_json::from_str::<TraceResultsWithTransactionHash>(reference_data).unwrap();
assert_eq!(trace.full_trace.output, Bytes::default());
}
}