Jrigada/min-example-1082

★ 0Forks 0SolidityGitHub ↗Compare

README

Foundry zkSync Issue #1082 Reproduction

This repository reproduces the panic issue described in foundry-zksync Issue #1082.

Issue Description

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.

Setup

  1. Clone this repository
  2. Install dependencies:
    forge install

Reproduction Steps

  1. Run regular tests (should work fine):

    forge test
  2. Run zkSync tests (should trigger the panic):

    forge test --zksync

Expected Behavior

  • Regular tests should pass without issues
  • zkSync tests should panic during contract deployment in setUp()

Environment

  • Solidity: ^0.8.24
  • Foundry: foundry-zksync

Contracts

  • XiaoLongBaoToken: Simple ERC20 token with mint functionality
  • MerkleAirdrop: Merkle proof-based airdrop contract
  • MerkleAirdropTest: Test contract that inherits from ZkSyncChainChecker

Key Code

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);
}

Contributors

dutterbutterJrigada

Issues