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
8.29k stars 1.75k forks source link

Core dump using forge script --debug #2841

Closed AmesCornish closed 1 year ago

AmesCornish commented 2 years ago

I'm suddenly having trouble debugging my scripts -- forge crashes. It may have something to do with console.log.

foundryup: installed - forge 0.2.0 (6b3db2a 2022-08-19T00:04:42.579272325Z)
foundryup: installed - cast 0.2.0 (6b3db2a 2022-08-19T00:04:42.579272325Z)
foundryup: installed - anvil 0.1.0 (6b3db2a 2022-08-19T00:04:43.018478595Z)

Description: Ubuntu 22.04.1 LTS

I'm attaching a zip'ed project. The crashing contract is:

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

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

contract ContractScript is Script {
    function setUp() public {}

    function run() public view {
        console.log("Beginning run()");
    }

}

$ ./anvil.sh

$ RUST_BACKTRACE=full forge script script/CoreDump.sol --debug
[⠆] Compiling...
No files changed, compilation skipped
The application panicked (crashed).
Message:  index out of bounds: the len is 0 but the index is 0
Location: /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/revm-1.9.0/src/interpreter/contract.rs:149

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

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   1: __libc_start_call_main<unknown>
      at ./csu/../sysdeps/nptl/libc_start_call_main.h:58
   2: __libc_start_main_impl<unknown>
      at ./csu/../csu/libc-start.c:392

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
Aborted (core dumped)

forge-crash.zip

DaniPopes commented 2 years ago

Could reproduce on the specified version, but it was fixed in a more recent version (run foundryup). we can close this

mds1 commented 1 year ago

Closing as resolved per @DaniPopes' comment