foundry-rs / foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
https://getfoundry.sh
Apache License 2.0
8.16k stars 1.69k forks source link

feat(`forge create / cast send`): add `--gas-estimate-multiplier` flag #1803

Open mattsse opened 2 years ago

mattsse commented 2 years ago

Component

Forge

Describe the feature you would like

For certain networks, gas(price) may be incorrectly estimated, resulting in transactions that are underpriced:

https://github.com/foundry-rs/foundry/issues/1703

in forge create we use the default Provider::{estimate_gas,get_gas_price} functions to fill the transactions, if they're not provided via cli arguments

it would be useful to scale these estimates percentage-wise, perhaps --scale-gas-limit 20 to use a 1.2 multiplier for the gas limit.

Additional context

No response

shawnharmsen commented 2 years ago

I'd like to take a stab at this, will update with pr soon

mattsse commented 2 years ago

awesome! keep 'em coming!

zerosnacks commented 1 month ago

Note for future reference: forge script implements this functionality under the --gas-estimate-multiplier flag, the goal of the ticket would be to implement this for cast send and forge create.