foundry
foundry copied to clipboard
`forge script` Avoid bulk gasEstimation when setting `--skip-simulation`
Motivation
Even when setting --skip-simulation
the current implementation still tries to estimate gas for all transactions in a script before submitting any of them.
Therefore scripts that have transactions that depend on previous tx's to succeed will fail. ( Avoiding which was one of the motivations to introduce --skip-simulation
in the first place).
Solution
When providing --skip-simulation
don't try to estimate gas until immediately before tx submission. (If you combine this with the --slow
option the state against which gas is estimated should include previous tx's from the same script, thus avoiding above outlined problem).
Ready for review. @onbjerg I commited the changed testcase into a separate commit (where it is failing) to illustrate the issue this pr is solving. Lmk if I should squash before merge. (or feel free to do so yourself).
lgtm, given the conflict fix
sorry was sick and my github notifications are a mess.
rebased, merging, after checks