Skip to content

Commit

Permalink
Handle time zero bug
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianGCalderon committed Dec 6, 2024
1 parent a2db2c4 commit 74ee2ab
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions replay/src/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,22 @@ fn get_class_executions(call: CallInfo) -> Vec<ClassExecutionInfo> {
// class hash can initially be None, but it is always added before execution
let class_hash = call.call.class_hash.unwrap();

let mut time = call.time;
let mut inner_time = Duration::ZERO;

let mut classes = call
.inner_calls
.into_iter()
.flat_map(|call| {
time -= call.time;
inner_time += call.time;
get_class_executions(call)
})
.collect::<Vec<_>>();

if call.time.is_zero() {
panic!("contract time should never be zero, there is a bug somewhere")
}
let time = call.time - inner_time;

let top_class = ClassExecutionInfo {
class_hash,
selector: call.call.entry_point_selector,
Expand Down

0 comments on commit 74ee2ab

Please sign in to comment.