Skip to content

Conversation

@onbjerg
Copy link
Member

@onbjerg onbjerg commented Jan 12, 2026

In isolation mode, the transaction environment is zeroed for fee-accounting purposes during synthetic transaction execution. This conflicts with cheatcodes that set these values, as the cheatcodes mutate the environment before it is zeroed.

The fix decouples the fee-accounting environment from the contract-visible environment by:

  1. Adding EnvOverrides to store basefee, gas_price, and blob_hashes overrides
  2. Adding in_isolation_context flag to Cheatcodes, set by InspectorStack
  3. Intercepting BASEFEE, GASPRICE, and BLOBHASH opcodes in step_end to replace stack values with the overrides
  4. Updating vm.fee, vm.txGasPrice, and vm.blobhashes to always set overrides, and only modify the actual environment when not in isolation mode

Closes #7277

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

…work in isolation mode

In isolation mode, the transaction environment is zeroed for fee-accounting
purposes during synthetic transaction execution. This conflicts with cheatcodes
that set these values, as the cheatcodes mutate the environment before it is
zeroed.

The fix decouples the fee-accounting environment from the contract-visible
environment by:

1. Adding `EnvOverrides` to store basefee, gas_price, and blob_hashes overrides
2. Adding `in_isolation_context` flag to `Cheatcodes`, set by `InspectorStack`
3. Intercepting `BASEFEE`, `GASPRICE`, and `BLOBHASH` opcodes in `step_end` to
   replace stack values with the overrides
4. Updating `vm.fee`, `vm.txGasPrice`, and `vm.blobhashes` to always set
   overrides, and only modify the actual environment when not in isolation mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

bug: vm.fee + vm.txGasPrice + vm.blobHashes cheatcodes incompatible with --gas-report/--isolate option

2 participants