Skip to content

refactor(evm): remove unused snap_tx_env from BackendStateSnapshot#13752

Merged
zerosnacks merged 3 commits intofoundry-rs:masterfrom
figtracer:refactor/remove-snap-tx-env
Mar 13, 2026
Merged

refactor(evm): remove unused snap_tx_env from BackendStateSnapshot#13752
zerosnacks merged 3 commits intofoundry-rs:masterfrom
figtracer:refactor/remove-snap-tx-env

Conversation

@figtracer
Copy link
Contributor

Summary

  • Remove the dead snap_tx_env field from BackendStateSnapshot — it was stored on every snapshot but destructured as _ on revert, never actually read back
  • Drop the tx_env parameter from DatabaseExt::snapshot_state, avoiding an unnecessary TxEnv clone on every snapshot
  • Inline EvmEnv construction in the cheatcode caller to avoid cloning TxEnv via clone_evm_and_tx

The `snap_tx_env` field was stored on every state snapshot but never
read back on revert — it was destructured as `_`. Remove it along with
the `tx_env` parameter from `DatabaseExt::snapshot_state`, avoiding an
unnecessary `TxEnv` clone on every snapshot.
@figtracer figtracer changed the title refactor(evm): remove unused snap_tx_env from BackendStateSnapshot refactor(evm): remove unused snap_tx_env from BackendStateSnapshot Mar 13, 2026
Copy link
Contributor

@mablr mablr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool 👍

@figtracer figtracer force-pushed the refactor/remove-snap-tx-env branch from 9a6e688 to d13a88f Compare March 13, 2026 17:46
@figtracer figtracer force-pushed the refactor/remove-snap-tx-env branch from 563e592 to ddca975 Compare March 13, 2026 20:39
@zerosnacks zerosnacks merged commit fecdd72 into foundry-rs:master Mar 13, 2026
16 checks passed
@github-project-automation github-project-automation bot moved this to Done in Foundry Mar 13, 2026
@figtracer figtracer deleted the refactor/remove-snap-tx-env branch March 13, 2026 21:21
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.

3 participants