Skip to content

Commit

Permalink
fix: Handle Emits in zk context (#294)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jrigada authored Mar 28, 2024
1 parent 8761286 commit 6c2bb7a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion crates/cheatcodes/src/inspector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1214,12 +1214,23 @@ impl<DB: DatabaseExt + Send> Inspector<DB> for Cheatcodes {
return match result {
ExecutionResult::Success { output, logs, .. } => match output {
Output::Call(bytes) => {
self.combined_logs.extend(logs.into_iter().map(|log| {
self.combined_logs.extend(logs.clone().into_iter().map(|log| {
Some(Log {
address: log.address,
data: LogData::new_unchecked(log.topics, log.data),
})
}));
//for each log in cloned logs call handle_expect_emit
if !self.expected_emits.is_empty() {
for log in logs {
expect::handle_expect_emit(
self,
&log.address,
&log.topics,
&log.data,
);
}
}
(InstructionResult::Return, gas, bytes)
}
_ => (InstructionResult::Revert, gas, Bytes::new()),
Expand Down

0 comments on commit 6c2bb7a

Please sign in to comment.