This repository reproduces the panic issue described in foundry-zksync Issue #1082.
When running tests that use ZkSyncChainChecker and attempt to deploy contracts in the setUp() function, foundry-zksync should panic with a "failed finding contract" error during the zkSync deployment path.
- Clone this repository
- Install dependencies:
forge install
-
Run regular tests (should work fine):
forge test -
Run zkSync tests (should trigger the panic):
forge test --zksync
- Regular tests should pass without issues
- zkSync tests should panic during contract deployment in
setUp()
- Solidity: ^0.8.24
- Foundry: foundry-zksync
XiaoLongBaoToken: Simple ERC20 token with mint functionalityMerkleAirdrop: Merkle proof-based airdrop contractMerkleAirdropTest: Test contract that inherits fromZkSyncChainChecker
The problematic code is in test/MerkleAirdropTest.t.sol in the setUp() function:
if (!isZkSyncChain()) {
DeployMerkleAirdrop deployer = new DeployMerkleAirdrop();
(airdrop, token) = deployer.deployMerkleAirdrop();
} else {
// This should cause the panic
token = new XiaoLongBaoToken();
airdrop = new MerkleAirdrop(ROOT, IERC20(address(token)));
token.mint(address(this), AMOUNT_TO_SEND);
token.transfer(address(airdrop), AMOUNT_TO_SEND);
}