Skip to content

Feat: custom Evm trait #572

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

julio4
Copy link
Contributor

@julio4 julio4 commented Apr 22, 2025

📝 Summary

  • Definition of a new Evm trait with only one method transact.
  • Evm from reth_evm, aliased as RethEvm, auto-implement this new Evm when trait bounds are satisfied.
  • EvmFactory's create_evm methods return Evm trait objects.
  • Update codebase to reflect these changes, such as mutating the db before creating evm in payout_tx

💡 Motivation and Context

This PR introduces a new trait Evm based on reth_evm::Evm but with more concrete trait bounds and less methods (only transact). It also simplifies the EvmFactory trait by removing the associated Evm type and not being constrained by revm inspector trait bounds.

All the logic of EthCachedEvmFactory stays the same, and this PR is mostly for better abstraction and giving more control to exactly what the Evm should provide to rbuilder.


✅ I have completed the following steps:

  • Run make lint
  • Run make test
  • Added tests (if applicable)

@Copilot Copilot AI review requested due to automatic review settings April 22, 2025 02:44
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request introduces a new, streamlined Evm trait with a single transact method while updating the EvmFactory to return trait objects using impl Evm, thereby simplifying the codebase. The updates consistently adjust import paths and refactor function signatures to match the new abstraction.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
crates/rbuilder/src/building/testing/evm_inspector_tests/setup.rs Updated imports to use evm::{Evm, EvmFactory} instead of reth_evm::Evm
crates/rbuilder/src/building/payout_tx.rs Modified creation order to update the cache account before instantiating Evm
crates/rbuilder/src/building/order_commit.rs Adjusted EvmFactory usage in the execute_evm function to use the new trait bounds
crates/rbuilder/src/building/evm.rs Introduced the new Evm trait and updated EvmFactory to return impl Evm trait objects

@ZanCorDX ZanCorDX marked this pull request as draft April 22, 2025 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant