matter-labs / foundry-zksync

Fork of Foundry tailored for zkSync environment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

missing CREATE2 deployer

lutr0 opened this issue · comments

commented

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 (76073b6 2024-09-11T00:22:22.118583532Z)

What command(s) is the bug in?

No response

Operating System

Linux

Describe the bug

I tried to use CREATE2 in the Counter example repo:

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import {Script, console} from "forge-std/Script.sol";
import {Counter} from "../src/Counter.sol";

contract CounterScript is Script {
    Counter public counter;

    function setUp() public {}

    function run() public {
        vm.startBroadcast();

        counter = new Counter{salt: ""}();

        vm.stopBroadcast();
    }
}

I get the same error on zkSync Sepolia and Sophon (respectively):

source .env && forge script ./script/Counter.s.sol --rpc-url https://sepolia.era.zksync.dev --private-key $PRIVATE_KEY --zksync --broadcast
[⠊] Compiling...
No files changed, compilation skipped
[⠃] Using zksolc-1.5.3
[⠊] Compiling (zksync)
No files changed, compilation skipped
2024-09-12T09:17:05.714298Z ERROR foundry_zksync_core::vm::tracer: call may fail or behave unexpectedly due to empty code target=0x4e59b44847b379578588920ca78fbf26c0b4956c calldata="0000000000000000000000000000000000000000000000000000000000000000608060405234801561000f575f80fd5b5060ec8061001c5f395ff3fe6080604052348015600e575f80fd5b5060043610603a575f3560e01c80633fb5c1cb14603e5780638381f58a14604f578063d09de08a146068575b5f80fd5b604d6049366004607d565b5f55565b005b60565f5481565b60405190815260200160405180910390f35b604d5f805490806076836093565b9190505550565b5f60208284031215608c575f80fd5b5035919050565b5f6001820160af57634e487b7160e01b5f52601160045260245ffd5b506001019056fea2646970667358221220e08b5f2ae4a0c9f4cffc2dd04a3f1f9789790baa7af33b2d4ff9176a75a71c3464736f6c63430008180033"
Traces:
  [185530] → new CounterScript@0x5b73C5498c1E3b4dbA84de0F1833c4a029d90519
    └─ ← [Return] 816 bytes of code

  [97] CounterScript::setUp()
    └─ ← [Stop] 

  [35262] CounterScript::run()
    ├─ [0] VM::startBroadcast()
    │   └─ ← [Return] 
    ├─ [0] Create2Deployer::create2()
    │   └─ ← [Revert] missing CREATE2 deployer
    └─ ← [Revert] missing CREATE2 deployer


Error: 
script failed: missing CREATE2 deployer
source .env && forge script ./script/Counter.s.sol --rpc-url https://rpc.testnet.sophon.xyz --private-key $PRIVATE_KEY --zksync --broadcast
[⠊] Compiling...
[⠒] Compiling 1 files with Solc 0.8.24
[⠢] Solc 0.8.24 finished in 992.79ms
Compiler run successful!
[⠃] Using zksolc-1.5.3
[⠊] Compiling (zksync)
[⠒] Compiling 1 files with zksolc and solc 0.8.24
[⠢] zksolc and solc 0.8.24 finished in 4.94s
Compiler run successful!
2024-09-12T09:14:12.962302Z ERROR foundry_zksync_core::vm::tracer: call may fail or behave unexpectedly due to empty code target=0x4e59b44847b379578588920ca78fbf26c0b4956c calldata="0000000000000000000000000000000000000000000000000000000000000000608060405234801561000f575f80fd5b5060ec8061001c5f395ff3fe6080604052348015600e575f80fd5b5060043610603a575f3560e01c80633fb5c1cb14603e5780638381f58a14604f578063d09de08a146068575b5f80fd5b604d6049366004607d565b5f55565b005b60565f5481565b60405190815260200160405180910390f35b604d5f805490806076836093565b9190505550565b5f60208284031215608c575f80fd5b5035919050565b5f6001820160af57634e487b7160e01b5f52601160045260245ffd5b506001019056fea2646970667358221220e08b5f2ae4a0c9f4cffc2dd04a3f1f9789790baa7af33b2d4ff9176a75a71c3464736f6c63430008180033"
Traces:
  [185530] → new CounterScript@0x5b73C5498c1E3b4dbA84de0F1833c4a029d90519
    └─ ← [Return] 816 bytes of code

  [97] CounterScript::setUp()
    └─ ← [Stop] 

  [35262] CounterScript::run()
    ├─ [0] VM::startBroadcast()
    │   └─ ← [Return] 
    ├─ [0] Create2Deployer::create2()
    │   └─ ← [Revert] missing CREATE2 deployer
    └─ ← [Revert] missing CREATE2 deployer


Error: 
script failed: missing CREATE2 deployer

Hello @lutr0 thanks for the example, it was really helpful. We just merged some new changes to be able to use the create2Factory deployed on zksync. It should be working from now on

commented

Confirmed, working on my side.
Congrats!