Impact: L
Likelihood: L
The following Foundry EVM cheatcodes are used in Deploy.s.sol::run() function:
vm.startBroadcast();
vm.stopBroadcast();
These cheatcodes do not work properly when used in a function that is called on ZkSync.
Likelihood:
The issue occurs when the Deploy.s.sol::run() is used in tests.
Impact:
The deploy script cannot be thoroughly tested in a fork test because when cheatcodes are used in a called function on ZkSync Era Mainnet, they do not work properly.
Please, add DeployTest.t.sol contract and run the fork test test_cheatcodesDoNotWorkProperly_onZkSync on ZkSync Era Mainnet using the command forge test --mt test_cheatcodesDoNotWorkProperly_onZkSync --fork-url $ZK_SYNC_MAINNET_URL --zksync -vvvvv
The test above will give an error: ERROR foundry_zksync_core::vm::tracers::cheatcode: call may fail or behave unexpectedly due to empty code target=0x7109709ecfa91a80626ff3989d68f67f5b1dd12d calldata="7fb5297f" and the test will revert.
The analisys of the error above leads to these conclusions:
The code target=0x7109709ecfa91a80626ff3989d68f67f5b1dd12d is the address of Vm as proved in the test test_checkTheVmAddress below:
The calldata="7fb5297f" is the startBroadcast() as proved by the command forge inspect Vm methods:
|------------------------------------------------------------------+------------|
| startBroadcast() | 7fb5297f |
|------------------------------------------------------------------+------------|
Redesign the deploy script to make it possible for testing:
add a separate function for MerkleAirdrop.sol funding;
call it from Deploy.s.sol::run() function.
Now, both functions Deploy.s.sol::deployMerkleDropper() and Deploy.s.sol::fundMerkleDropper() can be called from tests without issues instead of calling Deploy.s.sol::run().
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.