Skip to content

Commit

Permalink
Put back comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Jrigada committed Jan 3, 2025
1 parent 843acba commit 81cb004
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/zksync/core/src/vm/tracers/cheatcode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ impl<S: ReadStorage, H: HistoryMode> DynTracer<S, SimpleMemory<H>> for Cheatcode
value: Some(call_value),
};

// Try to find matching mock data
if let Some(return_data_queue) = match mocks.get_mut(&ctx) {
Some(queue) => Some(queue),
None => mocks
Expand All @@ -256,10 +255,11 @@ impl<S: ReadStorage, H: HistoryMode> DynTracer<S, SimpleMemory<H>> for Cheatcode
})
.map(|(_, v)| v),
} {
// Handle mock return data...
if let Some(return_data) = if return_data_queue.len() == 1 {
// If the mocked calls stack has a single element in it, don't empty it
return_data_queue.front().map(|x| x.to_owned())
} else {
// Else, we pop the front element
return_data_queue.pop_front()
} {
let return_data = return_data.data.clone().to_vec();
Expand All @@ -282,6 +282,8 @@ impl<S: ReadStorage, H: HistoryMode> DynTracer<S, SimpleMemory<H>> for Cheatcode
target = ?call_contract,
calldata = hex::encode(&call_input),
"call may fail or behave unexpectedly due to empty code{}",
// issue a more targeted
// error if we already had some mocks there
if has_mocks { " - please ensure the current calldata is mocked" } else { "" }
);
}
Expand Down

0 comments on commit 81cb004

Please sign in to comment.