diff --git a/user-ops-indexer/user-ops-indexer-logic/src/indexer/base_indexer.rs b/user-ops-indexer/user-ops-indexer-logic/src/indexer/base_indexer.rs index db4e27990..49efc819d 100644 --- a/user-ops-indexer/user-ops-indexer-logic/src/indexer/base_indexer.rs +++ b/user-ops-indexer/user-ops-indexer-logic/src/indexer/base_indexer.rs @@ -1,5 +1,9 @@ use crate::{ - indexer::{common_transport::CommonTransport, settings::IndexerSettings}, + indexer::{ + common_transport::CommonTransport, + rpc_utils::{CallTracer, TraceType}, + settings::IndexerSettings, + }, repository, types::user_op::UserOp, }; @@ -7,7 +11,7 @@ use anyhow::{anyhow, bail}; use ethers::prelude::{ abi::{AbiEncode, Error}, parse_log, - types::{Action, Address, Bytes, Filter, Log, TransactionReceipt}, + types::{Address, Bytes, Filter, Log, TransactionReceipt}, EthEvent, Middleware, Provider, ProviderError, H256, }; use futures::{ @@ -307,16 +311,15 @@ impl Indexer { "tx contains more than one bundle or was sent indirectly, fetching tx trace" ); self.client - .trace_transaction(tx_hash) + .common_trace_transaction(tx_hash) .await? .into_iter() .filter_map(|t| { - if let Action::Call(cd) = t.action { - if cd.to == L::entry_point() && L::matches_handler_calldata(&cd.input) { - Some(cd.input) - } else { - None - } + if t.typ == TraceType::Call + && t.to == Some(L::entry_point()) + && L::matches_handler_calldata(&t.input) + { + Some(t.input) } else { None } diff --git a/user-ops-indexer/user-ops-indexer-logic/src/indexer/mod.rs b/user-ops-indexer/user-ops-indexer-logic/src/indexer/mod.rs index 8f17fed05..12cf84aa1 100644 --- a/user-ops-indexer/user-ops-indexer-logic/src/indexer/mod.rs +++ b/user-ops-indexer/user-ops-indexer-logic/src/indexer/mod.rs @@ -1,6 +1,7 @@ mod base_indexer; mod common; pub mod common_transport; +pub mod rpc_utils; pub mod settings; pub mod v06; pub mod v07; diff --git a/user-ops-indexer/user-ops-indexer-logic/src/indexer/rpc_utils.rs b/user-ops-indexer/user-ops-indexer-logic/src/indexer/rpc_utils.rs new file mode 100644 index 000000000..28620642d --- /dev/null +++ b/user-ops-indexer/user-ops-indexer-logic/src/indexer/rpc_utils.rs @@ -0,0 +1,194 @@ +use async_trait::async_trait; +use ethers::prelude::{ + Action, Address, Bytes, CallFrame, CallType, GethDebugBuiltInTracerType, GethDebugTracerType, + GethDebugTracingOptions, GethTrace, GethTraceFrame, JsonRpcClient, Middleware, NodeClient, + Provider, ProviderError, TxHash, +}; + +#[derive(Debug, PartialEq)] +pub enum TraceType { + Call, + CallCode, + DelegateCall, + StaticCall, + Create, + Other, +} + +pub struct CommonCallTrace { + pub typ: TraceType, + pub from: Address, + pub to: Option
, + pub input: Bytes, +} + +#[async_trait] +pub trait CallTracer { + async fn common_trace_transaction( + &self, + tx_hash: TxHash, + ) -> Result, ProviderError>; +} + +#[async_trait] +impl CallTracer for Provider { + async fn common_trace_transaction( + &self, + tx_hash: TxHash, + ) -> Result, ProviderError> { + let client = self.node_client().await?; + + match client { + NodeClient::Geth => { + let geth_trace = self + .debug_trace_transaction( + tx_hash, + GethDebugTracingOptions { + disable_storage: Some(true), + disable_stack: Some(true), + enable_memory: Some(false), + enable_return_data: Some(false), + tracer: Some(GethDebugTracerType::BuiltInTracer( + GethDebugBuiltInTracerType::CallTracer, + )), + tracer_config: None, + timeout: Some("60s".to_string()), + }, + ) + .await?; + + match geth_trace { + GethTrace::Known(GethTraceFrame::CallTracer(root)) => { + Ok(flatten_geth_trace(root)) + } + _ => Err(ProviderError::CustomError( + "can't parse geth trace result".to_string(), + )), + } + } + _ => { + let traces = self + .trace_transaction(tx_hash) + .await? + .into_iter() + .filter_map(|t| match t.action { + Action::Call(call) => Some(CommonCallTrace { + typ: match call.call_type { + CallType::Call => TraceType::Call, + CallType::CallCode => TraceType::CallCode, + CallType::DelegateCall => TraceType::DelegateCall, + CallType::StaticCall => TraceType::StaticCall, + CallType::None => TraceType::Other, + }, + from: call.from, + to: Some(call.to), + input: call.input, + }), + Action::Create(create) => Some(CommonCallTrace { + typ: TraceType::Create, + from: create.from, + to: None, + input: create.init, + }), + _ => None, + }) + .collect(); + + Ok(traces) + } + } + } +} + +fn flatten_geth_trace(root: CallFrame) -> Vec { + let mut path = Vec::from([(&root, 0)]); + let mut res = Vec::new(); + + while let Some((frame, idx)) = path.pop() { + if idx == 0 { + res.push(CommonCallTrace { + typ: match frame.typ.as_str() { + "CALL" => TraceType::Call, + "CALLCODE" => TraceType::CallCode, + "STATICCALL" => TraceType::StaticCall, + "DELEGATECALL" => TraceType::DelegateCall, + "CREATE" => TraceType::Create, + "CREATE2" => TraceType::Create, + _ => TraceType::Other, + }, + from: frame.from, + to: frame.to.as_ref().and_then(|to| to.as_address().cloned()), + input: frame.input.clone(), + }); + } + if let Some(calls) = &frame.calls { + if calls.len() > idx { + path.push((&frame, idx + 1)); + path.push((&calls[idx], 0)); + } + } + } + + res +} + +#[cfg(test)] +mod tests { + use crate::indexer::rpc_utils::{flatten_geth_trace, TraceType}; + use ethers::prelude::{Address, Bytes, CallFrame}; + use ethers_core::utils::to_checksum; + use std::str::FromStr; + + #[test] + fn test_flatten_geth_trace() { + // optimism tx 0x0ea5571bc90fd76fe29e4e844ae74c901dac89032f6a01e2ec4e4fa9c4203824 + let root: CallFrame = serde_json::from_str(r#"{"from":"0x42fdd562221741a1db62a0f69a5a680367f07e33","gas":"0x15f900","gasUsed":"0x387dc","to":"0xca11bde05977b3631167028862be2a173976ca11","input":"0x174dea710000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000005ff137d4b0fdcd49dca30c7cf57e578a026d278900000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000007a41fad948c000000000000000000000000000000000000000000000000000000000000004000000000000000000000000004471500ac7147c158224fee67ac64227d3049de0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000003c00000000000000000000000008b9658b654efdfd69be5208e53342f5283f6486e00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000493e0000000000000000000000000000000000000000000000000000000000007a12000000000000000000000000000000000000000000000000000000000000186a0000000000000000000000000000000000000000000000000000000005a7817d80000000000000000000000000000000000000000000000000000000059682f0000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000104519454470000000000000000000000000b2c639c533813f4aa9d7837caf62653d097ff850000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044a9059cbb0000000000000000000000000b21f56063860b6aa1b86191a9dec568bebfdec50000000000000000000000000000000000000000000000000000000000e4e1be0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001400d5bda3b690c569c1c78a387ed6cf1a88ea7626000000000000000000000000000000000000000000000000000000000000000000000000000000000000004500000000c06e5c395501f2069dcbc9b05e75f9fd632765a99ebe8d2680862b95a3cfee5b581cfbbecc01c954b729c74b6b337e61fff043e1746f753d5a95913d8f13691d1b0000000000000000000000000000000000000000000000000000000000000000000000000000008b9658b654efdfd69be5208e53342f5283f6486e00000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000493e0000000000000000000000000000000000000000000000000000000000007a12000000000000000000000000000000000000000000000000000000000000186a0000000000000000000000000000000000000000000000000000000005a7817d80000000000000000000000000000000000000000000000000000000059682f0000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000104519454470000000000000000000000000b2c639c533813f4aa9d7837caf62653d097ff850000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044a9059cbb00000000000000000000000004471500ac7147c158224fee67ac64227d3049de00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001400d5bda3b690c569c1c78a387ed6cf1a88ea7626000000000000000000000000000000000000000000000000000000000000000000000000000000000000004500000000910c0077d5fba1f751d0ad9ae50d4595d9437fcbc8b7df19b3bdc97c59166df021a9bf7f913df6132acfa223bb9e4b26446461cfb99e837b86e5d070171a763c1c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","output":"0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000","calls":[{"from":"0xca11bde05977b3631167028862be2a173976ca11","gas":"0x150974","gasUsed":"0x2f5c7","to":"0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789","input":"0x1fad948c000000000000000000000000000000000000000000000000000000000000004000000000000000000000000004471500ac7147c158224fee67ac64227d3049de0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000003c00000000000000000000000008b9658b654efdfd69be5208e53342f5283f6486e00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000493e0000000000000000000000000000000000000000000000000000000000007a12000000000000000000000000000000000000000000000000000000000000186a0000000000000000000000000000000000000000000000000000000005a7817d80000000000000000000000000000000000000000000000000000000059682f0000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000104519454470000000000000000000000000b2c639c533813f4aa9d7837caf62653d097ff850000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044a9059cbb0000000000000000000000000b21f56063860b6aa1b86191a9dec568bebfdec50000000000000000000000000000000000000000000000000000000000e4e1be0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001400d5bda3b690c569c1c78a387ed6cf1a88ea7626000000000000000000000000000000000000000000000000000000000000000000000000000000000000004500000000c06e5c395501f2069dcbc9b05e75f9fd632765a99ebe8d2680862b95a3cfee5b581cfbbecc01c954b729c74b6b337e61fff043e1746f753d5a95913d8f13691d1b0000000000000000000000000000000000000000000000000000000000000000000000000000008b9658b654efdfd69be5208e53342f5283f6486e00000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000493e0000000000000000000000000000000000000000000000000000000000007a12000000000000000000000000000000000000000000000000000000000000186a0000000000000000000000000000000000000000000000000000000005a7817d80000000000000000000000000000000000000000000000000000000059682f0000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000104519454470000000000000000000000000b2c639c533813f4aa9d7837caf62653d097ff850000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044a9059cbb00000000000000000000000004471500ac7147c158224fee67ac64227d3049de00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001400d5bda3b690c569c1c78a387ed6cf1a88ea7626000000000000000000000000000000000000000000000000000000000000000000000000000000000000004500000000910c0077d5fba1f751d0ad9ae50d4595d9437fcbc8b7df19b3bdc97c59166df021a9bf7f913df6132acfa223bb9e4b26446461cfb99e837b86e5d070171a763c1c000000000000000000000000000000000000000000000000000000","calls":[{"from":"0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789","gas":"0x7a120","gasUsed":"0x6c9c","to":"0x8b9658b654efdfd69be5208e53342f5283f6486e","input":"0x3a871cdd0000000000000000000000000000000000000000000000000000000000000060dedc2b3442f65958bfdcd84c8f9efee89faeb15591a6a8e3a57cd81c560d384d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000008b9658b654efdfd69be5208e53342f5283f6486e00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000493e0000000000000000000000000000000000000000000000000000000000007a12000000000000000000000000000000000000000000000000000000000000186a0000000000000000000000000000000000000000000000000000000005a7817d80000000000000000000000000000000000000000000000000000000059682f0000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000104519454470000000000000000000000000b2c639c533813f4aa9d7837caf62653d097ff850000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044a9059cbb0000000000000000000000000b21f56063860b6aa1b86191a9dec568bebfdec50000000000000000000000000000000000000000000000000000000000e4e1be0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001400d5bda3b690c569c1c78a387ed6cf1a88ea7626000000000000000000000000000000000000000000000000000000000000000000000000000000000000004500000000c06e5c395501f2069dcbc9b05e75f9fd632765a99ebe8d2680862b95a3cfee5b581cfbbecc01c954b729c74b6b337e61fff043e1746f753d5a95913d8f13691d1b000000000000000000000000000000000000000000000000000000","output":"0x000065f698d2ffffffffffff0000000000000000000000000000000000000000","calls":[{"from":"0x8b9658b654efdfd69be5208e53342f5283f6486e","gas":"0x76fa0","gasUsed":"0x5932","to":"0x20029869dbea98c62c4eb85d85400ae833c0394b","input":"0x3a871cdd0000000000000000000000000000000000000000000000000000000000000060dedc2b3442f65958bfdcd84c8f9efee89faeb15591a6a8e3a57cd81c560d384d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000008b9658b654efdfd69be5208e53342f5283f6486e00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000493e0000000000000000000000000000000000000000000000000000000000007a12000000000000000000000000000000000000000000000000000000000000186a0000000000000000000000000000000000000000000000000000000005a7817d80000000000000000000000000000000000000000000000000000000059682f0000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000104519454470000000000000000000000000b2c639c533813f4aa9d7837caf62653d097ff850000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044a9059cbb0000000000000000000000000b21f56063860b6aa1b86191a9dec568bebfdec50000000000000000000000000000000000000000000000000000000000e4e1be0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001400d5bda3b690c569c1c78a387ed6cf1a88ea7626000000000000000000000000000000000000000000000000000000000000000000000000000000000000004500000000c06e5c395501f2069dcbc9b05e75f9fd632765a99ebe8d2680862b95a3cfee5b581cfbbecc01c954b729c74b6b337e61fff043e1746f753d5a95913d8f13691d1b000000000000000000000000000000000000000000000000000000","output":"0x000065f698d2ffffffffffff0000000000000000000000000000000000000000","calls":[{"from":"0x8b9658b654efdfd69be5208e53342f5283f6486e","gas":"0x72ba5","gasUsed":"0x3041","to":"0x7a5862415a6e55d71c21e78dd87a4a057073f411","input":"0x3a871cdd0000000000000000000000000000000000000000000000000000000000000060dedc2b3442f65958bfdcd84c8f9efee89faeb15591a6a8e3a57cd81c560d384d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000008b9658b654efdfd69be5208e53342f5283f6486e00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000493e0000000000000000000000000000000000000000000000000000000000007a12000000000000000000000000000000000000000000000000000000000000186a0000000000000000000000000000000000000000000000000000000005a7817d80000000000000000000000000000000000000000000000000000000059682f0000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000104519454470000000000000000000000000b2c639c533813f4aa9d7837caf62653d097ff850000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044a9059cbb0000000000000000000000000b21f56063860b6aa1b86191a9dec568bebfdec50000000000000000000000000000000000000000000000000000000000e4e1be0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001400d5bda3b690c569c1c78a387ed6cf1a88ea76260000000000000000000000000000000000000000000000000000000000000000000000000000000000000041c06e5c395501f2069dcbc9b05e75f9fd632765a99ebe8d2680862b95a3cfee5b581cfbbecc01c954b729c74b6b337e61fff043e1746f753d5a95913d8f13691d1b00000000000000000000000000000000000000000000000000000000000000","output":"0x000065f698d2000065f7ea520000000000000000000000000000000000000000","calls":[{"from":"0x7a5862415a6e55d71c21e78dd87a4a057073f411","gas":"0x70b5c","gasUsed":"0xbb8","to":"0x0000000000000000000000000000000000000001","input":"0xdedc2b3442f65958bfdcd84c8f9efee89faeb15591a6a8e3a57cd81c560d384d000000000000000000000000000000000000000000000000000000000000001bc06e5c395501f2069dcbc9b05e75f9fd632765a99ebe8d2680862b95a3cfee5b581cfbbecc01c954b729c74b6b337e61fff043e1746f753d5a95913d8f13691d","output":"0x000000000000000000000000a7b494e320acc72de6122e8e3783338741497e9e","type":"STATICCALL"},{"from":"0x7a5862415a6e55d71c21e78dd87a4a057073f411","gas":"0x6f439","gasUsed":"0xbb8","to":"0x0000000000000000000000000000000000000001","input":"0xbdc87cf20f24dbbb071f403150d9f118f102ddd52a804dd7db98681515d8bd7e000000000000000000000000000000000000000000000000000000000000001bc06e5c395501f2069dcbc9b05e75f9fd632765a99ebe8d2680862b95a3cfee5b581cfbbecc01c954b729c74b6b337e61fff043e1746f753d5a95913d8f13691d","output":"0x0000000000000000000000001b243979dd49d4f329b6298445efb77e86eb4d83","type":"STATICCALL"}],"value":"0x0","type":"CALL"}],"value":"0x0","type":"DELEGATECALL"}],"value":"0x0","type":"CALL"},{"from":"0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789","gas":"0x72126","gasUsed":"0x4d7","to":"0x00d5bda3b690c569c1c78a387ed6cf1a88ea7626","input":"0xf465c77e0000000000000000000000000000000000000000000000000000000000000060dedc2b3442f65958bfdcd84c8f9efee89faeb15591a6a8e3a57cd81c560d384d000000000000000000000000000000000000000000000000000a3eda744555000000000000000000000000008b9658b654efdfd69be5208e53342f5283f6486e00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000493e0000000000000000000000000000000000000000000000000000000000007a12000000000000000000000000000000000000000000000000000000000000186a0000000000000000000000000000000000000000000000000000000005a7817d80000000000000000000000000000000000000000000000000000000059682f0000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000104519454470000000000000000000000000b2c639c533813f4aa9d7837caf62653d097ff850000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044a9059cbb0000000000000000000000000b21f56063860b6aa1b86191a9dec568bebfdec50000000000000000000000000000000000000000000000000000000000e4e1be0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001400d5bda3b690c569c1c78a387ed6cf1a88ea7626000000000000000000000000000000000000000000000000000000000000000000000000000000000000004500000000c06e5c395501f2069dcbc9b05e75f9fd632765a99ebe8d2680862b95a3cfee5b581cfbbecc01c954b729c74b6b337e61fff043e1746f753d5a95913d8f13691d1b000000000000000000000000000000000000000000000000000000","output":"0x000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","value":"0x0","type":"CALL"},{"from":"0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789","gas":"0x7a120","gasUsed":"0x41a4","to":"0x8b9658b654efdfd69be5208e53342f5283f6486e","input":"0x3a871cdd000000000000000000000000000000000000000000000000000000000000006055031538b4ed6c73cde960fb2eee5c06a5282b0d49e6578a22dad2fb8f2abff100000000000000000000000000000000000000000000000000000000000000000000000000000000000000008b9658b654efdfd69be5208e53342f5283f6486e00000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000493e0000000000000000000000000000000000000000000000000000000000007a12000000000000000000000000000000000000000000000000000000000000186a0000000000000000000000000000000000000000000000000000000005a7817d80000000000000000000000000000000000000000000000000000000059682f0000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000104519454470000000000000000000000000b2c639c533813f4aa9d7837caf62653d097ff850000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044a9059cbb00000000000000000000000004471500ac7147c158224fee67ac64227d3049de00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001400d5bda3b690c569c1c78a387ed6cf1a88ea7626000000000000000000000000000000000000000000000000000000000000000000000000000000000000004500000000910c0077d5fba1f751d0ad9ae50d4595d9437fcbc8b7df19b3bdc97c59166df021a9bf7f913df6132acfa223bb9e4b26446461cfb99e837b86e5d070171a763c1c000000000000000000000000000000000000000000000000000000","output":"0x000065f698d2ffffffffffff0000000000000000000000000000000000000000","calls":[{"from":"0x8b9658b654efdfd69be5208e53342f5283f6486e","gas":"0x780ee","gasUsed":"0x3fce","to":"0x20029869dbea98c62c4eb85d85400ae833c0394b","input":"0x3a871cdd000000000000000000000000000000000000000000000000000000000000006055031538b4ed6c73cde960fb2eee5c06a5282b0d49e6578a22dad2fb8f2abff100000000000000000000000000000000000000000000000000000000000000000000000000000000000000008b9658b654efdfd69be5208e53342f5283f6486e00000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000493e0000000000000000000000000000000000000000000000000000000000007a12000000000000000000000000000000000000000000000000000000000000186a0000000000000000000000000000000000000000000000000000000005a7817d80000000000000000000000000000000000000000000000000000000059682f0000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000104519454470000000000000000000000000b2c639c533813f4aa9d7837caf62653d097ff850000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044a9059cbb00000000000000000000000004471500ac7147c158224fee67ac64227d3049de00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001400d5bda3b690c569c1c78a387ed6cf1a88ea7626000000000000000000000000000000000000000000000000000000000000000000000000000000000000004500000000910c0077d5fba1f751d0ad9ae50d4595d9437fcbc8b7df19b3bdc97c59166df021a9bf7f913df6132acfa223bb9e4b26446461cfb99e837b86e5d070171a763c1c000000000000000000000000000000000000000000000000000000","output":"0x000065f698d2ffffffffffff0000000000000000000000000000000000000000","calls":[{"from":"0x8b9658b654efdfd69be5208e53342f5283f6486e","gas":"0x74dfc","gasUsed":"0x2871","to":"0x7a5862415a6e55d71c21e78dd87a4a057073f411","input":"0x3a871cdd000000000000000000000000000000000000000000000000000000000000006055031538b4ed6c73cde960fb2eee5c06a5282b0d49e6578a22dad2fb8f2abff100000000000000000000000000000000000000000000000000000000000000000000000000000000000000008b9658b654efdfd69be5208e53342f5283f6486e00000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000493e0000000000000000000000000000000000000000000000000000000000007a12000000000000000000000000000000000000000000000000000000000000186a0000000000000000000000000000000000000000000000000000000005a7817d80000000000000000000000000000000000000000000000000000000059682f0000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000104519454470000000000000000000000000b2c639c533813f4aa9d7837caf62653d097ff850000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044a9059cbb00000000000000000000000004471500ac7147c158224fee67ac64227d3049de00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001400d5bda3b690c569c1c78a387ed6cf1a88ea76260000000000000000000000000000000000000000000000000000000000000000000000000000000000000041910c0077d5fba1f751d0ad9ae50d4595d9437fcbc8b7df19b3bdc97c59166df021a9bf7f913df6132acfa223bb9e4b26446461cfb99e837b86e5d070171a763c1c00000000000000000000000000000000000000000000000000000000000000","output":"0x000065f698d2000065f7ea520000000000000000000000000000000000000000","calls":[{"from":"0x7a5862415a6e55d71c21e78dd87a4a057073f411","gas":"0x72d29","gasUsed":"0xbb8","to":"0x0000000000000000000000000000000000000001","input":"0x55031538b4ed6c73cde960fb2eee5c06a5282b0d49e6578a22dad2fb8f2abff1000000000000000000000000000000000000000000000000000000000000001c910c0077d5fba1f751d0ad9ae50d4595d9437fcbc8b7df19b3bdc97c59166df021a9bf7f913df6132acfa223bb9e4b26446461cfb99e837b86e5d070171a763c","output":"0x000000000000000000000000a496a2426fb717409a471f0fcef6d20dc069fc2c","type":"STATICCALL"},{"from":"0x7a5862415a6e55d71c21e78dd87a4a057073f411","gas":"0x71606","gasUsed":"0xbb8","to":"0x0000000000000000000000000000000000000001","input":"0xe12c7cc1f1266db450bb061a37e16f9eb41e67cc034dbf09b24824bb9fda449b000000000000000000000000000000000000000000000000000000000000001c910c0077d5fba1f751d0ad9ae50d4595d9437fcbc8b7df19b3bdc97c59166df021a9bf7f913df6132acfa223bb9e4b26446461cfb99e837b86e5d070171a763c","output":"0x0000000000000000000000001b243979dd49d4f329b6298445efb77e86eb4d83","type":"STATICCALL"}],"value":"0x0","type":"CALL"}],"value":"0x0","type":"DELEGATECALL"}],"value":"0x0","type":"CALL"},{"from":"0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789","gas":"0x755f6","gasUsed":"0x4d7","to":"0x00d5bda3b690c569c1c78a387ed6cf1a88ea7626","input":"0xf465c77e000000000000000000000000000000000000000000000000000000000000006055031538b4ed6c73cde960fb2eee5c06a5282b0d49e6578a22dad2fb8f2abff1000000000000000000000000000000000000000000000000000a3eda744555000000000000000000000000008b9658b654efdfd69be5208e53342f5283f6486e00000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000493e0000000000000000000000000000000000000000000000000000000000007a12000000000000000000000000000000000000000000000000000000000000186a0000000000000000000000000000000000000000000000000000000005a7817d80000000000000000000000000000000000000000000000000000000059682f0000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000104519454470000000000000000000000000b2c639c533813f4aa9d7837caf62653d097ff850000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044a9059cbb00000000000000000000000004471500ac7147c158224fee67ac64227d3049de00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001400d5bda3b690c569c1c78a387ed6cf1a88ea7626000000000000000000000000000000000000000000000000000000000000000000000000000000000000004500000000910c0077d5fba1f751d0ad9ae50d4595d9437fcbc8b7df19b3bdc97c59166df021a9bf7f913df6132acfa223bb9e4b26446461cfb99e837b86e5d070171a763c1c000000000000000000000000000000000000000000000000000000","output":"0x000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","value":"0x0","type":"CALL"},{"from":"0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789","gas":"0x1359ab","gasUsed":"0xc66d","to":"0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789","input":"0x1d73275600000000000000000000000000000000000000000000000000000000000001c00000000000000000000000008b9658b654efdfd69be5208e53342f5283f6486e000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000493e0000000000000000000000000000000000000000000000000000000000007a12000000000000000000000000000000000000000000000000000000000000186a000000000000000000000000000d5bda3b690c569c1c78a387ed6cf1a88ea7626000000000000000000000000000000000000000000000000000000005a7817d80000000000000000000000000000000000000000000000000000000059682f00dedc2b3442f65958bfdcd84c8f9efee89faeb15591a6a8e3a57cd81c560d384d000000000000000000000000000000000000000000000000000a3eda744555000000000000000000000000000000000000000000000000000000000000000680000000000000000000000000000000000000000000000000000000000002541a00000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000104519454470000000000000000000000000b2c639c533813f4aa9d7837caf62653d097ff850000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044a9059cbb0000000000000000000000000b21f56063860b6aa1b86191a9dec568bebfdec50000000000000000000000000000000000000000000000000000000000e4e1be00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","output":"0x00000000000000000000000000000000000000000000000000010f5cf6029997","calls":[{"from":"0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789","gas":"0x493e0","gasUsed":"0xadc9","to":"0x8b9658b654efdfd69be5208e53342f5283f6486e","input":"0x519454470000000000000000000000000b2c639c533813f4aa9d7837caf62653d097ff850000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044a9059cbb0000000000000000000000000b21f56063860b6aa1b86191a9dec568bebfdec50000000000000000000000000000000000000000000000000000000000e4e1be00000000000000000000000000000000000000000000000000000000","output":"0x0000000000000000000000000000000000000000000000000000000000000001","calls":[{"from":"0x8b9658b654efdfd69be5208e53342f5283f6486e","gas":"0x4806d","gasUsed":"0xac7f","to":"0x20029869dbea98c62c4eb85d85400ae833c0394b","input":"0x519454470000000000000000000000000b2c639c533813f4aa9d7837caf62653d097ff850000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044a9059cbb0000000000000000000000000b21f56063860b6aa1b86191a9dec568bebfdec50000000000000000000000000000000000000000000000000000000000e4e1be00000000000000000000000000000000000000000000000000000000","output":"0x0000000000000000000000000000000000000000000000000000000000000001","calls":[{"from":"0x8b9658b654efdfd69be5208e53342f5283f6486e","gas":"0x460b8","gasUsed":"0x9e73","to":"0x0b2c639c533813f4aa9d7837caf62653d097ff85","input":"0xa9059cbb0000000000000000000000000b21f56063860b6aa1b86191a9dec568bebfdec50000000000000000000000000000000000000000000000000000000000e4e1be","output":"0x0000000000000000000000000000000000000000000000000000000000000001","calls":[{"from":"0x0b2c639c533813f4aa9d7837caf62653d097ff85","gas":"0x433ae","gasUsed":"0x8253","to":"0xded3b9a8dbedc2f9cb725b55d0e686a81e6d06dc","input":"0xa9059cbb0000000000000000000000000b21f56063860b6aa1b86191a9dec568bebfdec50000000000000000000000000000000000000000000000000000000000e4e1be","output":"0x0000000000000000000000000000000000000000000000000000000000000001","value":"0x0","type":"DELEGATECALL"}],"value":"0x0","type":"CALL"}],"value":"0x0","type":"DELEGATECALL"}],"value":"0x0","type":"CALL"}],"value":"0x0","type":"CALL"},{"from":"0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789","gas":"0x129046","gasUsed":"0x88b5","to":"0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789","input":"0x1d73275600000000000000000000000000000000000000000000000000000000000001c00000000000000000000000008b9658b654efdfd69be5208e53342f5283f6486e000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000493e0000000000000000000000000000000000000000000000000000000000007a12000000000000000000000000000000000000000000000000000000000000186a000000000000000000000000000d5bda3b690c569c1c78a387ed6cf1a88ea7626000000000000000000000000000000000000000000000000000000005a7817d80000000000000000000000000000000000000000000000000000000059682f0055031538b4ed6c73cde960fb2eee5c06a5282b0d49e6578a22dad2fb8f2abff1000000000000000000000000000000000000000000000000000a3eda7445550000000000000000000000000000000000000000000000000000000000000009c0000000000000000000000000000000000000000000000000000000000001efd800000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000104519454470000000000000000000000000b2c639c533813f4aa9d7837caf62653d097ff850000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044a9059cbb00000000000000000000000004471500ac7147c158224fee67ac64227d3049de000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","output":"0x0000000000000000000000000000000000000000000000000000d675dce98765","calls":[{"from":"0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789","gas":"0x493e0","gasUsed":"0x7011","to":"0x8b9658b654efdfd69be5208e53342f5283f6486e","input":"0x519454470000000000000000000000000b2c639c533813f4aa9d7837caf62653d097ff850000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044a9059cbb00000000000000000000000004471500ac7147c158224fee67ac64227d3049de000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000","output":"0x0000000000000000000000000000000000000000000000000000000000000001","calls":[{"from":"0x8b9658b654efdfd69be5208e53342f5283f6486e","gas":"0x4806d","gasUsed":"0x6ec7","to":"0x20029869dbea98c62c4eb85d85400ae833c0394b","input":"0x519454470000000000000000000000000b2c639c533813f4aa9d7837caf62653d097ff850000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044a9059cbb00000000000000000000000004471500ac7147c158224fee67ac64227d3049de000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000","output":"0x0000000000000000000000000000000000000000000000000000000000000001","calls":[{"from":"0x8b9658b654efdfd69be5208e53342f5283f6486e","gas":"0x46a55","gasUsed":"0x6a7f","to":"0x0b2c639c533813f4aa9d7837caf62653d097ff85","input":"0xa9059cbb00000000000000000000000004471500ac7147c158224fee67ac64227d3049de0000000000000000000000000000000000000000000000000000000000000002","output":"0x0000000000000000000000000000000000000000000000000000000000000001","calls":[{"from":"0x0b2c639c533813f4aa9d7837caf62653d097ff85","gas":"0x45623","gasUsed":"0x67c3","to":"0xded3b9a8dbedc2f9cb725b55d0e686a81e6d06dc","input":"0xa9059cbb00000000000000000000000004471500ac7147c158224fee67ac64227d3049de0000000000000000000000000000000000000000000000000000000000000002","output":"0x0000000000000000000000000000000000000000000000000000000000000001","value":"0x0","type":"DELEGATECALL"}],"value":"0x0","type":"CALL"}],"value":"0x0","type":"DELEGATECALL"}],"value":"0x0","type":"CALL"}],"value":"0x0","type":"CALL"},{"from":"0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789","gas":"0x11e498","gasUsed":"0x18b9","to":"0x04471500ac7147c158224fee67ac64227d3049de","input":"0x","calls":[{"from":"0x04471500ac7147c158224fee67ac64227d3049de","gas":"0x118aa2","gasUsed":"0x5e0","to":"0xfb1bffc9d739b8d520daf37df666da4c687191ea","input":"0x","value":"0x1e5d2d2ec20fc","type":"DELEGATECALL"}],"value":"0x1e5d2d2ec20fc","type":"CALL"}],"value":"0x0","type":"CALL"}],"value":"0x0","type":"CALL"}"#, ).unwrap(); + let res = flatten_geth_trace(root); + + assert_eq!(res.len(), 26); + assert_eq!(res[1].typ, TraceType::Call); + assert_eq!( + res[1].from, + Address::from_str("0xcA11bde05977b3631167028862bE2a173976CA11").unwrap() + ); + assert_eq!( + res[1].to, + Some(Address::from_str("0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789").unwrap()) + ); + assert_eq!(res[1].input, Bytes::from_str("0x1fad948c000000000000000000000000000000000000000000000000000000000000004000000000000000000000000004471500ac7147c158224fee67ac64227d3049de0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000003c00000000000000000000000008b9658b654efdfd69be5208e53342f5283f6486e00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000493e0000000000000000000000000000000000000000000000000000000000007a12000000000000000000000000000000000000000000000000000000000000186a0000000000000000000000000000000000000000000000000000000005a7817d80000000000000000000000000000000000000000000000000000000059682f0000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000104519454470000000000000000000000000b2c639c533813f4aa9d7837caf62653d097ff850000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044a9059cbb0000000000000000000000000b21f56063860b6aa1b86191a9dec568bebfdec50000000000000000000000000000000000000000000000000000000000e4e1be0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001400d5bda3b690c569c1c78a387ed6cf1a88ea7626000000000000000000000000000000000000000000000000000000000000000000000000000000000000004500000000c06e5c395501f2069dcbc9b05e75f9fd632765a99ebe8d2680862b95a3cfee5b581cfbbecc01c954b729c74b6b337e61fff043e1746f753d5a95913d8f13691d1b0000000000000000000000000000000000000000000000000000000000000000000000000000008b9658b654efdfd69be5208e53342f5283f6486e00000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000493e0000000000000000000000000000000000000000000000000000000000007a12000000000000000000000000000000000000000000000000000000000000186a0000000000000000000000000000000000000000000000000000000005a7817d80000000000000000000000000000000000000000000000000000000059682f0000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000104519454470000000000000000000000000b2c639c533813f4aa9d7837caf62653d097ff850000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044a9059cbb00000000000000000000000004471500ac7147c158224fee67ac64227d3049de00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001400d5bda3b690c569c1c78a387ed6cf1a88ea7626000000000000000000000000000000000000000000000000000000000000000000000000000000000000004500000000910c0077d5fba1f751d0ad9ae50d4595d9437fcbc8b7df19b3bdc97c59166df021a9bf7f913df6132acfa223bb9e4b26446461cfb99e837b86e5d070171a763c1c000000000000000000000000000000000000000000000000000000").unwrap()); + + assert_eq!( + res.iter() + .map(|t| to_checksum(&t.from, None).to_lowercase()) + .collect::>(), + [ + "0x42fdd562221741a1db62a0f69a5a680367f07e33", + "0xca11bde05977b3631167028862be2a173976ca11", + "0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789", + "0x8b9658b654efdfd69be5208e53342f5283f6486e", + "0x8b9658b654efdfd69be5208e53342f5283f6486e", + "0x7a5862415a6e55d71c21e78dd87a4a057073f411", + "0x7a5862415a6e55d71c21e78dd87a4a057073f411", + "0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789", + "0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789", + "0x8b9658b654efdfd69be5208e53342f5283f6486e", + "0x8b9658b654efdfd69be5208e53342f5283f6486e", + "0x7a5862415a6e55d71c21e78dd87a4a057073f411", + "0x7a5862415a6e55d71c21e78dd87a4a057073f411", + "0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789", + "0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789", + "0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789", + "0x8b9658b654efdfd69be5208e53342f5283f6486e", + "0x8b9658b654efdfd69be5208e53342f5283f6486e", + "0x0b2c639c533813f4aa9d7837caf62653d097ff85", + "0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789", + "0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789", + "0x8b9658b654efdfd69be5208e53342f5283f6486e", + "0x8b9658b654efdfd69be5208e53342f5283f6486e", + "0x0b2c639c533813f4aa9d7837caf62653d097ff85", + "0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789", + "0x04471500ac7147c158224fee67ac64227d3049de", + ] + ); + } +}