Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No on-chain traces present to help debug failing forge script #2865

Closed
2 tasks done
Stentonian opened this issue Aug 21, 2022 · 0 comments · Fixed by #2875
Closed
2 tasks done

No on-chain traces present to help debug failing forge script #2865

Stentonian opened this issue Aug 21, 2022 · 0 comments · Fixed by #2875
Assignees
Labels
C-forge Command: forge Cmd-forge-script Command: forge script T-bug Type: bug

Comments

@Stentonian
Copy link

Stentonian commented Aug 21, 2022

Component

Forge

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

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (29ff0b0 2022-08-21T00:04:31.695466171Z)

What command(s) is the bug in?

forge script

Operating System

Linux

Describe the bug

Hi there, I'm having trouble getting my script to work and I'm looking for help on how to find logs/traces. Here is a summary of the issue:

I have a script like this:

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

contract MyScript is Test {
  function run() public {
    console2.log("Start");
    vm.startBroadcast();
    doStuff();
    vm.stopBroadcast();
    console2.log("Finish");
  }
}

I try to run this script using the forge script command, and have tried using mumbai (without broadcast flag) and ganache (with broadcast flag) networks (both are giving me the same issue). Here are the commands:

# mumbai
RUST_BACKTRACE=full forge script ./MyScript.s.sol:MyScript --rpc-url $MUMBAI_RPC_URL --private-key $PRIVATE_KEY -vvvv

# ganache
RUST_BACKTRACE=full forge script ./MyScript.s.sol:MyScript --rpc-url $GANACHE_RPC_URL --private-key $GANACHE_DETERMINISTIC_KEY --broadcast --legacy -vvvv

Depending on what I put in doStuff() the script either passes or fails, so of course there is an issue with the solidity code, but the reason I posted this bug report is because I have no visibility into what is going wrong. And I need some help from traces/logs because the code that is breaking is rather large and not easy to step thru manually.

[assume using mumbai command for the next section]

In the successful case (doStuff() is very simple) I get a response like this:

# ...some traces.. 
Script ran successfully.

== Logs ==
# ...some logs...
==========================
Simulated On-chain Traces:

  [22605] ERC1967Proxy::mint(20000000000000000000) 
    └─  ()

==========================

Estimated total gas used for script: 29386

Estimated amount required: 0.000088158000528948 ETH

==========================

SIMULATION COMPLETE. To broadcast these transactions, add --broadcast and wallet configuration(s) to the previous command. See forge script --help for more.

But in the failing case (complex doStuff()) I get a response like this:

# ...some traces.. 
Script ran successfully.

== Logs ==
# ...some logs...
==========================
Simulated On-chain Traces:

The application panicked (crashed).
Message:  Internal EVM error: 
Execution reverted: EvmError: Revert (gas: 265926)
Location: cli/src/cmd/forge/script/executor.rs:124

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

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   1: __libc_start_main<unknown>
      at <unknown source file>:<unknown line>

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.

There is no information to help me debug. Is there any way I can get some more insight into where the script is failing?

@Stentonian Stentonian added the T-bug Type: bug label Aug 21, 2022
@rkrasiuk rkrasiuk added C-forge Command: forge Cmd-forge-script Command: forge script labels Aug 22, 2022
@joshieDo joshieDo self-assigned this Aug 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-forge Command: forge Cmd-forge-script Command: forge script T-bug Type: bug
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants