foundry-rs / foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
https://getfoundry.sh
Apache License 2.0
7.85k stars 1.56k forks source link

Bug on Deployment to ZKsync #8156

Open jtfirek opened 2 weeks ago

jtfirek commented 2 weeks ago

Component

Forge

Have you ensured that all of these are up to date?

What version of Foundry are you on?

forge 0.2.0 (e0ea59c 2024-04-24T00:17:37.065879000Z)

What command(s) is the bug in?

forge script

Operating System

macOS (Apple Silicon)

Describe the bug

forge script --chain 324 script/OFTConfigure.sol:DeployOFTScript --rpc-url $RPC_URL --broadcast --verify --etherscan-api-key $ETHERSCAN_API_KEY -vvv [⠢] Compiling... [⠆] Compiling 2 files with 0.8.25 [⠰] Solc 0.8.25 finished in 2.12s Compiler run successful! The application panicked (crashed). Message: called Option::unwrap() on a None value Location: /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/revm-8.0.0/src/inspector/handler_register.rs:198

This is a bug. Consider reporting it at https://github.com/foundry-rs/foundry

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ⋮ 8 frames hidden ⋮
9: core::panicking::panic::h3131e0868b9f8622 at : 10: core::option::unwrap_failed::hdb518deb484b6610 at : 11: revm::inspector::handler_register::inspector_handle_register::{{closure}}::h4267af1945b14904 at : 12: revm::evm::Evm<EXT,DB>::transact::hc098e979d8f4081a at : 13: foundry_evm::executors::Executor::call_raw::h002954fbbb7c604c at : 14: forge_script::runner::ScriptRunner::call::h11367cefefe39cab at : 15: forge_script::execute::PreExecutionState::execute::{{closure}}::h670442284707f0cf at : 16: forge_script::ScriptArgs::run_script::{{closure}}::h75ca2c06ff9d8cd0 at : 17: forge::main::h250832e8765746d2 at : 18: std::sys_common::backtrace::__rust_begin_short_backtrace::h014dc81c722c4340 at : 19: _main at :

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering. zsh: abort forge script --chain 324 script/OFTConfigure.sol:DeployOFTScript --rpc-url

jtfirek commented 2 weeks ago

The transaction succeed when I remove the SALT cheatcode even though I have used this same script to deploy to other chains

Failure:

        oftDeployment.implementationAddress = address(new MintableOFTUpgradeable{salt: SALT}(DEPLOYMENT_LZ_ENDPOINT));
        oftDeployment.proxyAddress = address(
            new TransparentUpgradeableProxy{salt: SALT}(
                oftDeployment.implementationAddress,
                scriptDeployer,
                abi.encodeWithSelector(
                    MintableOFTUpgradeable.initialize.selector, TOKEN_NAME, TOKEN_SYMBOL, scriptDeployer
                )
            )
        );

Successful:

          oftDeployment.implementationAddress = address(new MintableOFTUpgradeable(DEPLOYMENT_LZ_ENDPOINT));
        oftDeployment.proxyAddress = address(
            new TransparentUpgradeableProxy(
                oftDeployment.implementationAddress,
                scriptDeployer,
                abi.encodeWithSelector(
                    MintableOFTUpgradeable.initialize.selector, TOKEN_NAME, TOKEN_SYMBOL, scriptDeployer
                )
            )
        );
klkvr commented 2 weeks ago

likely https://github.com/foundry-rs/foundry/pull/7838, you can update to latest nightly to avoid panic

zkSync does not have default CREATE2 deployer predeployed (0x4e59b44847b379578588920ca78fbf26c0b4956c), so CREATE2 deployments from scripts can't be supported there