foundry-zksync: .call{value: value}(new bytes(0)) causes ERROR call may fail or behave unexpectedly due to empty code
Component
Forge
Have you ensured that all of these are up to date?
- Foundry
- Foundryup
What version of Foundry are you on?
forge 0.0.2 (68fcb7d 2024-12-16T00:45:46.210537000Z)
What command(s) is the bug in?
forge test
Operating System
macOS (Apple Silicon)
Describe the bug
Sending eth with .call causes the following log in my forge test output:
2024-12-18T22:55:36.093440Z ERROR foundry_zksync_core::vm::tracers::cheatcode: call may fail or behave unexpectedly due to empty code target=0x0000000000000000000000000000000000989682 calldata=""
Although it displays it as an ERROR, the execution continues. Due to having a lot of tests and fuzzing, this really pollutes my console.
Proposed solution: When calldata is empty, due not assume it’s a function call, don’t check the address for code.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (9 by maintainers)
That specific bit is because the target address is already being mocked, it’s just the input calldata that differs from what was specified in the mock. If the address wasn’t being mocked it wouldn’t show the second section of the message 😉
Glad to know the issue is fixed ❤️
I meant that if the fix was done thru #804 then you shouldn’t be seeing the issue anymore, so I was double checking with @Jrigada that the PR in question is actually the fix, and if it is then we should investigate why you are still observing the error 😃
So yeah, it was supposed to fix it (from what I can tell) but didn’t