Skip to content

fix(cheatcodes): preserve nested EVM changes on executeTransaction#13645

Merged
mattsse merged 2 commits intofoundry-rs:masterfrom
figtracer:fig/fix-execute-transaction-env
Mar 6, 2026
Merged

fix(cheatcodes): preserve nested EVM changes on executeTransaction#13645
mattsse merged 2 commits intofoundry-rs:masterfrom
figtracer:fig/fix-execute-transaction-env

Conversation

@figtracer
Copy link
Contributor

executeTransaction zeroes basefee and gas_price before running the nested EVM, then restores the original env afterward. But apply_env(cached_env) discards any env changes made by cheatcodes (e.g. vm.warp, vm.roll, vm.chainId) called during the nested execution.

Uses NestedEvm::to_env() (#13642) to capture the nested EVM's env after execution, then restores only the fields we modified (tx, basefee) from the cached original.

@figtracer figtracer force-pushed the fig/fix-execute-transaction-env branch from d4884f7 to f97046e Compare March 5, 2026 19:15
@mattsse mattsse merged commit 02e8e43 into foundry-rs:master Mar 6, 2026
16 checks passed
@github-project-automation github-project-automation bot moved this to Done in Foundry Mar 6, 2026
@figtracer figtracer deleted the fig/fix-execute-transaction-env branch March 6, 2026 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants