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

bug(forge script): --skip-simulation does not skip simulation #6825

Open
2 tasks done
Philogy opened this issue Jan 16, 2024 · 7 comments
Open
2 tasks done

bug(forge script): --skip-simulation does not skip simulation #6825

Philogy opened this issue Jan 16, 2024 · 7 comments
Assignees
Labels
C-forge Command: forge Cmd-forge-script Command: forge script T-bug Type: bug

Comments

@Philogy
Copy link

Philogy commented Jan 16, 2024

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 (24abca6 2024-01-16T00:26:29.551032000Z)

What command(s) is the bug in?

forge script --skip-simulation

Operating System

macOS (Apple Silicon)

Describe the bug

Often there are things that my script depends on that foundry is unable to simulate correctly (self-destruct reinit, hot/cold storage gas cost).

Whether --skip-simulation is provided or not forge script will simulate the script first before attempting to broadcast it. Meaning that if it's incorrectly failing in the simulation I'm unable to broadcast transactions using foundry.

The --skip-simulation flag does however get the script runner to exclaim "SKIPPING ON CHAIN SIMULATION." after it has successfully ran the simulation 😅
image

@Philogy Philogy added the T-bug Type: bug label Jan 16, 2024
@gakonst gakonst added this to Foundry Jan 16, 2024
@github-project-automation github-project-automation bot moved this to Todo in Foundry Jan 16, 2024
@mattsse mattsse self-assigned this Jan 16, 2024
@mattsse
Copy link
Member

mattsse commented Jan 16, 2024

thanks for flagging, possible regression, fixing asap

@mattsse
Copy link
Member

mattsse commented Jan 16, 2024

do you have a minimal repro for this?

@Sabnock01
Copy link
Contributor

Had some previous discussion in #5776

@Philogy
Copy link
Author

Philogy commented Jan 16, 2024

Yeah based on @Evalir's comment here: #5776 (comment) it does seem like this intentional and kind of unavoidable based on how scripts currently work.

Unfortunately, this does mean that forge script is unusable for me in many use-cases. Specifically because of the simulation being in 1 tx (meaning gas accounting for warm/cold storage slots will be off and self-destruct / reinit doesn't work).

Not sure how you'd fix this exactly, maybe have a separate environment in which the script contract is run and the actual simulation itself, any external CALLs made in one are captured and emitted as transactions in the actual environment?

@Philogy
Copy link
Author

Philogy commented Jan 16, 2024

Here's a minimal repro

This seems like a niche case but there are others like self-destruct, reinit or other weird dependencies like gas-price that would cause the same issue

@plotchy
Copy link
Contributor

plotchy commented Jan 17, 2024

copying good background provided by @Evalir from #5776 :

--skip-simulation avoids using the provided URL to do gas estimation. It does not prevent foundry from simulating the script locally. The latter is not possible to disable, as we must simulate the script to gather all the transactions to broadcast. If the local simulation fails, the whole script fails.

much of my experience with wanting this feature to avoid local sim was around similar edge cases. On-chain randomness where the randomness is seeded by things like gas, gas-limit, coinbase, etc that is difficult to match exactly in a forge script.

@Xenoset77
Copy link

Can we get an ETA on this?

@zerosnacks zerosnacks added C-forge Command: forge Cmd-forge-script Command: forge script labels Jul 4, 2024
@zerosnacks zerosnacks changed the title --skip-simulation does not skip simulation bug(forge script): --skip-simulation does not skip simulation Jul 4, 2024
@zerosnacks zerosnacks changed the title bug(forge script): --skip-simulation does not skip simulation bug(forge script): --skip-simulation does not skip simulation Jul 4, 2024
@zerosnacks zerosnacks added this to the v1.0.0 milestone Jul 26, 2024
@grandizzy grandizzy assigned grandizzy and unassigned mattsse Oct 28, 2024
@grandizzy grandizzy removed this from the v1.0.0 milestone Oct 29, 2024
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
Status: Todo
Development

No branches or pull requests

7 participants