alloy-rs / evm

EVM abstraction layer

Repository from Github https://github.comalloy-rs/evmRepository from Github https://github.comalloy-rs/evm

[Feature] Add a way to install handlers on `EthEvm`

zerosnacks opened this issue · comments

Describe the feature you would like

In Foundry we have to override some EVM behavior at runtime (specifically around deploying with a default CREATE2 factory contract), I think it would make sense to expose a convenient way to override behavior in alloy-evm.

The preferred way of interacting with handlers to override behavior would be directly on EthEvm / OpEvm, instead of a seperate EthEvmHandler / OpEvmHandler to align with pre-REVM 20 DX.

Reference: https://github.com/bluealloy/revm/blob/main/examples/my_evm/src/handler.rs

Original context: https://github.com/foundry-rs/foundry/blob/97724afac2dc61ed8eace9e9c114f2fc80cc0264/crates/evm/core/src/utils.rs#L193-L367

A previous prototype implementation with a wrapper looked as follows: https://github.com/foundry-rs/foundry/blob/ab7112704b37aa8486365c4dea85faa8620de06d/crates/evm/core/src/evm.rs prior to Foundry moving to use alloy-evm directly

Additional context

No response

After discussing we will likely implement this directly in Foundry rather than alloy-evm , for the time being marking this as not planned