Searches recursively for create call frame Ignores reverting call frames
(
call_frame: &CallFrame,
address: &Address,
)
| 149 | // Searches recursively for create call frame |
| 150 | // Ignores reverting call frames |
| 151 | fn extract_create_call_frame( |
| 152 | call_frame: &CallFrame, |
| 153 | address: &Address, |
| 154 | ) -> Result<CallFrame, ValidationError> { |
| 155 | if call_frame.typ.starts_with("CREATE") |
| 156 | && call_frame.error.is_none() |
| 157 | && call_frame.to.as_ref().and_then(|to| to.as_address()) == Some(address) |
| 158 | { |
| 159 | return Ok(call_frame.clone()); |
| 160 | } |
| 161 | |
| 162 | if let Some(calls) = &call_frame.calls { |
| 163 | for call in calls { |
| 164 | if call.error.is_none() { |
| 165 | if let Ok(call_frame) = extract_create_call_frame(call, address) { |
| 166 | return Ok(call_frame); |
| 167 | } |
| 168 | } |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | Err(ValidationError::from("Cannot determine create addresses")) |
| 173 | } |
| 174 | pub fn get_eth_debug_call_trace( |
| 175 | config: &DVFConfig, |
| 176 | tx_id: &str, |