Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit 9947695

Browse files
authored
Parse internal calls (#915)
1 parent d25ac3f commit 9947695

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

rpc_state_reader/src/lib.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,7 @@ mod tests {
926926
]),
927927
}
928928
);
929+
assert_eq!(tx_trace.validate_invocation.internal_calls.len(), 1);
929930

930931
assert_eq!(
931932
tx_trace.function_invocation.calldata,
@@ -965,6 +966,19 @@ mod tests {
965966
]),
966967
}
967968
);
969+
assert_eq!(tx_trace.function_invocation.internal_calls.len(), 1);
970+
assert_eq!(
971+
tx_trace.function_invocation.internal_calls[0]
972+
.internal_calls
973+
.len(),
974+
1
975+
);
976+
assert_eq!(
977+
tx_trace.function_invocation.internal_calls[0].internal_calls[0]
978+
.internal_calls
979+
.len(),
980+
7
981+
);
968982

969983
assert_eq!(
970984
tx_trace.fee_transfer_invocation.calldata,
@@ -989,5 +1003,6 @@ mod tests {
9891003
]),
9901004
}
9911005
);
1006+
assert_eq!(tx_trace.fee_transfer_invocation.internal_calls.len(), 1);
9921007
}
9931008
}

src/execution/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,20 @@ impl<'de> Deserialize<'de> for CallInfo {
265265
let calldata_value = value["calldata"].clone();
266266
let calldata = parse_felt_array(calldata_value.as_array().unwrap());
267267

268+
// Parse internal calls
269+
let internal_calls_value = value["internal_calls"].clone();
270+
let mut internal_calls = vec![];
271+
272+
for call in internal_calls_value.as_array().unwrap() {
273+
internal_calls
274+
.push(serde_json::from_value(call.clone()).map_err(serde::de::Error::custom)?);
275+
}
276+
268277
Ok(CallInfo {
269278
execution_resources,
270279
retdata,
271280
calldata,
281+
internal_calls,
272282
..Default::default()
273283
})
274284
}

0 commit comments

Comments
 (0)