Skip to content

refactor(evm): simplify Backend::initialize and CowBackend::backend_mut#13755

Open
figtracer wants to merge 1 commit intofoundry-rs:masterfrom
figtracer:refactor/cow-backend-init
Open

refactor(evm): simplify Backend::initialize and CowBackend::backend_mut#13755
figtracer wants to merge 1 commit intofoundry-rs:masterfrom
figtracer:refactor/cow-backend-init

Conversation

@figtracer
Copy link
Contributor

Summary

  • Backend::initialize now takes (SpecId, Address, TxKind) instead of &Env, removing the need to construct a full Env just to extract three fields
  • CowBackend replaces spec_id: Option<SpecId> with pending_init: Option<(SpecId, Address, TxKind)>, capturing all init params upfront in inspect
  • CowBackend::backend_mut() becomes zero-arg — no longer needs (evm_env, tx_env) passed through every DatabaseExt method call

@figtracer figtracer changed the title refactor(evm): simplify Backend::initialize and CowBackend::backend_mut refactor(evm): simplify Backend::initialize and CowBackend::backend_mut Mar 14, 2026
…d_mut`

`initialize` now takes `(SpecId, Address, TxKind)` instead of `&Env`,
since those are the only fields it reads. This removes the need for
`backend_mut` to clone `EvmEnv` — it only needs `&TxEnv` now, because
the `SpecId` already comes from `self.spec_id`.

Moves towards aligning with alloy-evm's BlockExecutor ownership model
where `EvmEnv` is block-scoped and `TxEnv` is tx-scoped.
@figtracer figtracer force-pushed the refactor/cow-backend-init branch from d33186a to 717297d Compare March 14, 2026 18:01
@figtracer figtracer marked this pull request as ready for review March 14, 2026 19:22
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.

I'm supportive for this because it removes evm_env/tx_env requirement just to get mutable backend, which probably unlocks further simplifications (eg. on roll fork methods)

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.

2 participants