Skip to content

Commit 6470d98

Browse files
committed
feat: handle trace boundaries in external events
1 parent 780db4f commit 6470d98

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

crates/movy-replay/src/tracer/trace.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,16 @@ impl TraceState {
117117
self.loaded_state.insert(*id, snapshot.clone());
118118
}
119119
},
120-
// External events are treated opaqeuly
121-
TraceEvent::External(_) => (),
120+
// External events are treated opaquely unless they define a trace boundary.
121+
TraceEvent::External(external) => {
122+
if external.as_str().is_some_and(|s| s == "MoveCallStart") {
123+
// New trace boundary. Reset reconstructed runtime state to avoid
124+
// leaking values across calls/txns.
125+
self.loaded_state.clear();
126+
self.operand_stack.clear();
127+
self.call_stack.clear();
128+
}
129+
}
122130
// Instructions
123131
TraceEvent::Instruction { .. } | TraceEvent::BeforeInstruction { .. } => (),
124132
}
@@ -150,4 +158,3 @@ impl Tracer for TraceState {
150158
// no emit for
151159
}
152160
}
153-

0 commit comments

Comments
 (0)