Skip to content

Commit

Permalink
fix: rm outdated flatten (paradigmxyz#3630)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse committed Jul 6, 2023
1 parent 350f1a1 commit 6d5b6c6
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions crates/rpc/rpc-types/src/eth/trace/parity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,8 @@ pub enum TraceOutput {
pub struct TransactionTrace {
#[serde(flatten)]
pub action: Action,
#[serde(flatten)]
#[serde(flatten, skip_serializing_if = "Option::is_none")]
pub error: Option<String>,
#[serde(flatten)]
pub result: Option<TraceOutput>,
pub subtraces: usize,
pub trace_address: Vec<usize>,
Expand Down Expand Up @@ -303,3 +302,35 @@ pub struct StorageDelta {
pub key: U256,
pub val: U256,
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_transaction_trace() {
let s = r#"{
"action": {
"from": "0x66e29f0b6b1b07071f2fde4345d512386cb66f5f",
"callType": "call",
"gas": "0x10bfc",
"input": "0xf6cd1e8d0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000011c37937e080000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ec6952892271c8ee13f12e118484e03149281c9600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000010480862479000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000160f5f00288e9e1cc8655b327e081566e580a71d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000011c37937e080000fffffffffffffffffffffffffffffffffffffffffffffffffee3c86c81f8000000000000000000000000000000000000000000000000000000000000",
"to": "0x160f5f00288e9e1cc8655b327e081566e580a71d",
"value": "0x244b"
},
"blockHash": "0xbca9ee244882bd00a19737a66f24002a4562a949c4d5ebd03c32e04111cff536",
"blockNumber": 17600209,
"error": "Reverted",
"result": {
"gasUsed": "0x9daf",
"output": "0x000000000000000000000000000000000000000000000000011c37937e080000"
},
"subtraces": 3,
"traceAddress": [],
"transactionHash": "0x0e48a8d4419efaa2d3a9b8f625a1c559a4179fd19ddd10c02842965f3a7e7b63",
"transactionPosition": 0,
"type": "call"
}"#;
let _val = serde_json::from_str::<TransactionTrace>(s).unwrap();
}
}

0 comments on commit 6d5b6c6

Please sign in to comment.