Skip to content

Commit

Permalink
do not handle expectCall in zkEVM
Browse files Browse the repository at this point in the history
  • Loading branch information
nbaztec committed Jan 6, 2025
1 parent 2a052c6 commit 58fbde0
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions crates/zksync/core/src/vm/tracers/cheatcode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,32 +206,6 @@ impl<S: ReadStorage, H: HistoryMode> DynTracer<S, SimpleMemory<H>> for Cheatcode
) {
self.farcall_handler.track_call_actions(&state, &data);

// Checks contract calls for expectCall cheatcode
if let Opcode::FarCall(_call) = data.opcode.variant.opcode {
let current = state.vm_local_state.callstack.current;
if let Some(expected_calls_for_target) =
self.expected_calls.get_mut(&current.code_address.to_address())
{
let calldata = get_calldata(&state, memory);
// Match every partial/full calldata
for (expected_calldata, (expected, actual_count)) in expected_calls_for_target {
// Increment actual times seen if...
// The calldata is at most, as big as this call's input, and
if expected_calldata.len() <= calldata.len() &&
// Both calldata match, taking the length of the assumed smaller one (which will have at least the selector), and
*expected_calldata == calldata[..expected_calldata.len()] &&
// The value matches, if provided
expected
.value
.map_or(true, |value|{
value == rU256::from(current.context_u128_value)})
{
*actual_count += 1;
}
}
}
}

// Handle mocked calls
if let Opcode::FarCall(_call) = data.opcode.variant.opcode {
let current = state.vm_local_state.callstack.current;
Expand Down

0 comments on commit 58fbde0

Please sign in to comment.