Skip to content

refactor(anvil): remove some intermediate Env wrappers, pass EvmEnv directly#13941

Merged
zerosnacks merged 1 commit intofoundry-rs:masterfrom
mablr:refactor/anvil-remove-env-wrapper
Mar 26, 2026
Merged

refactor(anvil): remove some intermediate Env wrappers, pass EvmEnv directly#13941
zerosnacks merged 1 commit intofoundry-rs:masterfrom
mablr:refactor/anvil-remove-env-wrapper

Conversation

@mablr
Copy link
Contributor

@mablr mablr commented Mar 26, 2026

Motivation

Replace usage of the Env struct wrapper with direct EvmEnv references in new_eth_evm_with_inspector, validate_pool_transaction_for, and validate_for. The optimism flag is now passed explicitly as is_optimism: bool instead of being extracted from env.networks. This eliminates unnecessary Env::new(...) construction in several hot paths (block mining, pending block simulation, tx replay) and simplifies the function signatures.

…rectly

Replace usage of the `Env` struct wrapper with direct `EvmEnv` references
in `new_eth_evm_with_inspector`, `validate_pool_transaction_for`, and
`validate_for`. The optimism flag is now passed explicitly as `is_optimism: bool`
instead of being extracted from `env.networks`. This eliminates unnecessary
`Env::new(...)` construction in several hot paths (block mining, pending block
simulation, tx replay) and simplifies the function signatures.
Copy link
Member

@zerosnacks zerosnacks left a comment

Choose a reason for hiding this comment

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

RE: is_optimism param, makes sense as a simplification for now; once more network specific handling is needed we can make this more elegant again.

@zerosnacks zerosnacks enabled auto-merge (squash) March 26, 2026 10:29
@zerosnacks zerosnacks merged commit 081540c into foundry-rs:master Mar 26, 2026
16 checks passed
@github-project-automation github-project-automation bot moved this to Done in Foundry Mar 26, 2026
Copy link
Contributor Author

@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.

Of course, all of these will be just dropped asap with BlockExecutorFactory introduction.

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