MCPcopy Create free account
hub / github.com/ChainSecurity/deployment_validation / get_eth_debug_trace

Function get_eth_debug_trace

lib/web3.rs:191–234  ·  view source on GitHub ↗
(
    config: &DVFConfig,
    tx_id: &str,
)

Source from the content-addressed store, hash-verified

189}
190
191pub fn get_eth_debug_trace(
192 config: &DVFConfig,
193 tx_id: &str,
194) -> Result<TraceWithAddress, ValidationError> {
195 let request_body = json!({
196 "jsonrpc": "2.0",
197 "method": "debug_traceTransaction",
198 "params": [tx_id, {"enableMemory": true, "enableStorage": true, "enableReturnData": false}],
199 "id": 1
200 });
201 let result = send_blocking_web3_post(config, &request_body)?;
202 // Parse the response as a JSON list
203 let trace: DefaultFrame = serde_json::from_value(result)?;
204
205 let request_body = json!({
206 "jsonrpc": "2.0",
207 "method": "eth_getTransactionReceipt",
208 "params": [tx_id],
209 "id": 1
210 });
211 let result = send_blocking_web3_post(config, &request_body)?;
212 // Parse the response as a JSON list
213 let receipt: TransactionReceipt = serde_json::from_value(result)?;
214
215 let tx_id = tx_id.to_string();
216 if let Some(address) = receipt.to {
217 Ok(TraceWithAddress {
218 trace,
219 address,
220 tx_id,
221 })
222 } else if let Some(address) = receipt.contract_address {
223 return Ok(TraceWithAddress {
224 trace,
225 address,
226 tx_id,
227 });
228 } else {
229 return Err(ValidationError::from(format!(
230 "Found no address for tx {}",
231 tx_id
232 )));
233 }
234}
235
236// Returns create addresses of internal calls, if the initial call is a create, then it is not included
237// Reverting creates are indicated with a Zero address

Callers 5

get_many_debug_tracesFunction · 0.85
snapshot_from_tx_idsMethod · 0.85
gen_testFunction · 0.85
processFunction · 0.85

Calls 2

send_blocking_web3_postFunction · 0.85
to_stringMethod · 0.80

Tested by 1

gen_testFunction · 0.68