foundry icon indicating copy to clipboard operation
foundry copied to clipboard

panic: chisel is crashing w/ `range end index 32 out of range for slice of length 0`

Open spaceh3ad opened this issue 1 month ago • 6 comments

Component

Chisel

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

  • [x] Foundry
  • [x] Foundryup

What version of Foundry are you on?

forge Version: 1.4.4-stable

What version of Foundryup are you on?

foundryup: 1.1.0

What command(s) is the bug in?

chisel

Operating System

None

Describe the bug

Welcome to Chisel! Type `!help` to show available commands.
➜ address a = address(123);
➜ bytes32(bytes20(a))
The application panicked (crashed).
Message:  range end index 32 out of range for slice of length 0
Location: crates/chisel/src/executor.rs:163

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

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                                ⋮ 8 frames hidden ⋮                               
   9: core::slice::index::slice_index_fail::do_panic::runtime::hbee3c28697385720
      at <unknown source file>:<unknown line>
  10: core::slice::index::slice_index_fail::h7c4bced4ab1ab8e2
      at <unknown source file>:<unknown line>
  11: chisel::executor::<impl chisel::source::SessionSource>::inspect::{{closure}}::h49c906441debae26
      at <unknown source file>:<unknown line>
  12: chisel::dispatcher::ChiselDispatcher::dispatch::{{closure}}::hee212d34e46a32db
      at <unknown source file>:<unknown line>
  13: chisel::args::run_command::{{closure}}::hc31c099b246b6a54
      at <unknown source file>:<unknown line>
  14: chisel::args::run::h517b0563edc6e98c
      at <unknown source file>:<unknown line>
  15: chisel::main::h36d05d08073d8c9d
      at <unknown source file>:<unknown line>
  16: std::sys::backtrace::__rust_begin_short_backtrace::h3708230a3f64b525
      at <unknown source file>:<unknown line>
  17: _main<unknown>
      at <unknown source file>:<unknown line>

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
[1]    10410 abort      RUST_BACKTRACE=full chisel

spaceh3ad avatar Nov 21 '25 12:11 spaceh3ad

Hmm, I'm unable to reproduce this with chisel 1.4.4-stable (05794498bf 2025-11-03T23:44:21.031788094Z)

chisel
Welcome to Chisel! Type `!help` to show available commands.
➜ address a = address(123);
➜ bytes32(bytes20(a))
Type: bytes32
└ Data: 0x000000000000000000000000000000000000007b00000000000000000000000

zerosnacks avatar Nov 21 '25 12:11 zerosnacks

Hi @spaceh3ad would you mind posting the exact output of chisel --version? I'm also unable to reproduce it on nightly.

zerosnacks avatar Nov 21 '25 16:11 zerosnacks

❯ chisel --version
chisel Version: 1.4.4-stable
Commit SHA: 05794498bf47257b144e2e2789a1d5bf8566be0e
Build Timestamp: 2025-11-03T23:46:57.847015000Z (1762213617)
Build Profile: maxperf

spaceh3ad avatar Nov 21 '25 16:11 spaceh3ad

@spaceh3ad is this win or which OS you use?

grandizzy avatar Nov 22 '25 06:11 grandizzy

@grandizzy macos

spaceh3ad avatar Nov 25 '25 11:11 spaceh3ad

what solc version are you using? can you also show !md and !so before the command that crashes?


memory is empty here https://github.com/foundry-rs/foundry/blob/445f34070f5b07d20c24e5142260d8b57ba48210/crates/chisel/src/executor.rs#L107

comes from the step_end https://github.com/foundry-rs/foundry/blob/445f34070f5b07d20c24e5142260d8b57ba48210/crates/evm/evm/src/inspectors/chisel_state.rs#L34-L43

DaniPopes avatar Nov 27 '25 14:11 DaniPopes