Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Exclude from empty code error case where there is no calldata and value #804

Merged
merged 5 commits into from
Jan 9, 2025

Conversation

Jrigada
Copy link
Contributor

@Jrigada Jrigada commented Jan 3, 2025

What 💻

  • ERROR foundry_zksync_core::vm::tracers::cheatcode: call may fail or behave unexpectedly due to empty code target=0x0000000000000000000000000000000000989682 calldata="" appears repeatedly, flooding the terminal and slowing down test execution.

Why ✋

  • Exclude from error generation cases where we are sending balance to an EOA

@Jrigada Jrigada changed the title Check empty code only inside mock block fix: Check empty code only inside mock block Jan 3, 2025
@nbaztec
Copy link
Collaborator

nbaztec commented Jan 6, 2025

The error message is a more general error that is printed if the user tries to call any contract with empty bytecode. The issue here seems that address(...).call{value: 10}("") is a valid variant in zkEVM. Perhaps it makes sense to detect this pattern for exclusion instead. Normally I'd guess that this call gets translated to a call to the L2_BASE_TOKEN_ADDRESS instead (which has bytecode) but maybe something is amiss.

@Karrq
Copy link
Contributor

Karrq commented Jan 8, 2025

It shouldn't be a call to L2_BASE_TOKEN_ADDRESS but instead a call to the given address, using MSG_VALUE_SIMULATOR to send the funds.
The easy workaround is to vm.mockCall the address + calldata pair, so we don't get that shown and the target contract is still able to receive funds.

@Jrigada Jrigada changed the title fix: Check empty code only inside mock block fix: Exclude from empty code error case where there is no calldata and value Jan 8, 2025
@Jrigada Jrigada marked this pull request as ready for review January 8, 2025 19:30
@Jrigada Jrigada requested a review from a team as a code owner January 8, 2025 19:30
nbaztec
nbaztec previously approved these changes Jan 9, 2025
crates/forge/tests/cli/zk_cmd.rs Outdated Show resolved Hide resolved
elfedy
elfedy previously approved these changes Jan 9, 2025
crates/forge/tests/cli/zk_cmd.rs Outdated Show resolved Hide resolved
crates/forge/tests/cli/zk_cmd.rs Outdated Show resolved Hide resolved
@Jrigada Jrigada dismissed stale reviews from elfedy and nbaztec via ed72264 January 9, 2025 12:11
@Jrigada Jrigada merged commit 1cd2c56 into main Jan 9, 2025
23 checks passed
@Jrigada Jrigada deleted the jrigada-fix-error-empty-code branch January 9, 2025 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants