Skip to content

bug: vm.txGasPrice cheatcode incompatible with --gas-report/--isolate option #7277

Open
@KirienzoEth

Description

@KirienzoEth

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 (2f432fb 2024-02-29T00:16:38.827810253Z)

What command(s) is the bug in?

forge test --gas-report

Operating System

Windows

Describe the bug

Example repo: https://github.com/KirienzoEth/foundry-gas-report-txgasprice-issue

The vm.txGasPrice cheatcode seems to be incompatible with the use of --gas-report in functions that use tx.gasprice.

The --gas-report option seem to be calling the contract that is tested with a new transaction (to measure the gas used I'm assuming), but as vm.txGasPrice only works in the current transaction (see foundry book), any function relying on tx.gasprice will fail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions