foundry icon indicating copy to clipboard operation
foundry copied to clipboard

bug(`anvil`): `--disable-block-gas-limit` vs `--gas-limit`

Open adraffy opened this issue 1 year ago • 1 comments

Component

Anvil

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

  • [X] Foundry
  • [X] Foundryup

What version of Foundry are you on?

forge 0.2.0 (d28a337 2024-08-27T00:20:10.476146991Z)

What command(s) is the bug in?

No response

Operating System

Linux

Describe the bug

  • When on a fork, for view calls, --gas-limit=99...99 doesn't work but --disable-block-gas-limit works.
  • When not on a fork, --disable-block-gas-limit doesn't work but --gas-limit=99...99 works.

By works, I mean, doesn't revert EVM error OutOfGas.

adraffy avatar Aug 27 '24 19:08 adraffy

  • setup_fork_db_config() ignores NodeConfig.gas_limit https://github.com/foundry-rs/foundry/blob/2442e7a5fc165d7d0b022aa8b9f09dcdf675157b/crates/anvil/src/config.rs#L1141
  • setup() only uses NodeConfig.gas_limit but passes disable_block_gas_limit to CfgEnvWithHandlerCfg https://github.com/foundry-rs/foundry/blob/2442e7a5fc165d7d0b022aa8b9f09dcdf675157b/crates/anvil/src/config.rs#L949-L959
  • not clear if disable_block_gas_limit prop is used anywhere in foundry_evm https://github.com/foundry-rs/foundry/blob/2442e7a5fc165d7d0b022aa8b9f09dcdf675157b/crates/evm/evm/src/executors/builder.rs#L84

adraffy avatar Aug 27 '24 20:08 adraffy