-
Notifications
You must be signed in to change notification settings - Fork 131
Feat: evm
module with custom EvmFactory
trait
#554
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
Feat: evm
module with custom EvmFactory
trait
#554
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Please add comments on trait EvmFactory (reason of existing, basically what you explain here!). |
Changing the dependency on EthEvmFactory and calling EthEvmFactory::default() seems dangerous, you are trusting the implementation of EthEvmFactory will not change. If in the future EthEvmFactory::default() gets super expensive and stores some internal data we'll get a performance penalty. |
I see, because before it was calling
Done. |
65e8a34
to
13083e9
Compare
You are copy/pasting the code of EthEvmFactory. Unless you can show me something we win with the copy/paste, can we go back to having a EthEvmFactory inside EthCachedEvmFactory? |
Yes this is done one purpose to have the same logic as |
Yes please 🙏 I trust reth people, if they decide to change EthEvmFactory it will be for good reasons. |
This reverts commit 1052c79.
13083e9
to
9a75082
Compare
Done. Thanks for the valuable comments. |
💡 Motivation and Context
This PR brings small code cleanup for
EvmFactory
. I have created a newEvmFactory
trait in rbuilder because theEvm
trait fromalloy_revm
has a lot of associated types and trait bounds.These are now defined in the custom
EvmFactory
trait and resolved in the implementation forEthCachedEvmFactory
, so this removes the need for extra trait bounds outside of theevm
module (such as in theexecute_evm
function inorder_commit
).📝 Summary
EthCachedEvmFactory
was moved to new moduleevm
underbuilding
(rbuilder::building::evm
), IMO this makes the overall code structure better as the separation of concerns is cleaner (more obvious)EthCachedEvmFactory::Context
is defined toEthEvmContext<DB>
, which is an alias ofContext<BlockEnv, TxEnv, CfgEnv, DB>
EvmFactory
custom trait, which is a more concrete version thanalloy_revm::EvmFactory
EthEvmFactory
inEthCachedEvmFactory
struct, but still use it's default implementation under the hood (we can also consider completely remove it and useContext
instead)✅ I have completed the following steps:
make lint
make test