foundry-rs / foundry-rs/foundry

bug(`cast`): `cast run` does not work sometimes with weird errors (lack of funds, nonce too low, etc.)

Open
#10,863 6 comments 0 reactions 0 assignees View on GitHub
C-cast T-bug
Dominant language
Rust
Stars
10.6k
Forks
2.6k
Avg merge
18h 20m
Merged PRs (30d)
510

Description

### Component

Forge, Cast

### 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.2.3-stable

### What version of Foundryup are you on?

foundryup: 0.3.3

### What command(s) is the bug in?

Cast run

### Operating System

macOS (Apple Silicon)

### Describe the bug

Sometimes when I run cast run I do not get any stack trace.
Here is one example:

Case 1:
`cast run 0xe5dff9c3f5ec5b1af5f641f1c1f1829b38713641b4401b2affeaf794d7b48e0b --rpc-url https://zksync2-mainnet.zksync.io -vvv`

Explorer URL 1:
https://era.zksync.network/tx/0xe5dff9c3f5ec5b1af5f641f1c1f1829b38713641b4401b2affeaf794d7b48e0b
Explorer URL 2:
https://explorer.zksync.io/tx/0xe5dff9c3f5ec5b1af5f641f1c1f1829b38713641b4401b2affeaf794d7b48e0b
(in this explorer we get some data back that helps to extract the revert reason)
Also Phalcon is able to produce a full stack trace:
https://app.blocksec.com/explorer/tx/zksync-era/0xe5dff9c3f5ec5b1af5f641f1c1f1829b38713641b4401b2affeaf794d7b48e0b

This transaction uses a precompile which in Telegram was pointed out could be an issue. Is there a way this could be improved so that also those stack traces are shown?

![Image](https://github.com/user-attachments/assets/75636c25-307b-4681-9e65-2f3c55954968)

---------
Case 2:
Here is a second transaction that does not work:

`cast run 0x715e633fc1ae98bfda07a52b11758acb9bd5bf73cd4c386708e694ec42da5924 --rpc-url https://rpc.hyperliquid.xyz/evm -vvv`

Explorer URL:
https://www.hyperscan.com/tx/0x715e633fc1ae98bfda07a52b11758acb9bd5bf73cd4c386708e694ec42da5924

This one is more difficult to debug since HyperEVM is not supported by Tenderly or Phalcon which is why I would love to see a full stack trace for it.
But using cast run we get a nonce too low error (that i've seen a few times before):

![Image](https://github.com/user-attachments/assets/2fb3cd57-04ef-414c-a9b5-21ed7df93b8b)

adding the flag `--trace-printer` also does not yield any more output.

Is this a bug? Can this be improved somehow?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.