foundry icon indicating copy to clipboard operation
foundry copied to clipboard

Core dump using forge script --debug

Open AmesCornish opened this issue 2 years ago • 1 comments

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

  • The Foundry version you are on (and that it is up to date)
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)
  • The platform you are on (Windows, macOS, an M1 Mac or Windows)

Description: Ubuntu 22.04.1 LTS

  • Code snippets if this is happening in relation to testing or building code

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

}
  • Concrete steps to reproduce the bug

$ ./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

AmesCornish avatar Aug 19 '22 00:08 AmesCornish

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

DaniPopes avatar Sep 14 '22 16:09 DaniPopes

Closing as resolved per @DaniPopes' comment

mds1 avatar Apr 11 '23 22:04 mds1