-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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: introduce evm config trait #6461
Conversation
04d994f
to
cd2e600
Compare
crates/node-api/src/evm/traits.rs
Outdated
} | ||
|
||
/// An executor capable of executing a block. | ||
pub trait BlockExecutor { |
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.
do we dedupe with
pub trait BlockExecutor { |
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.
yep, actually I think I'll move this to a new crate that reth-provider
and node-api
will both depend on, instead of including this (and relevant types) in node-api
. Mainly to avoid circular dependencies, and avoid making node-api
gigantic
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.
actually, hmm, need to think more about this, this might not work
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.
Thinking we can get rid of potential reth-provider
dependency issues by making the error type an associated type on BlockExecutor
.
final challenge w.r.t. the BlockExecutor trait: Two potential solutions:
Wrapping is easy but the trait seems more idiomatic, so I'm proposing we create a trait that can write |
6c76c87
to
c0ad49f
Compare
I'd lean towards proposal 2 as well since it is the approach we are doing for other things |
c0ad49f
to
1cc52ff
Compare
Defining trait EvmConfig {
/// the executor type
type Executor: BlockExecutor;
/// returns the executor with the installed db
fn evm(&self, db: impl Database) -> Self::Executor;
} has been scoped out for a few reasons:
The idea to have Where are we now?Now we're focusing on a trait like this: /// Trait for configuring the EVM for executing full blocks.
pub trait EvmConfig {
/// Returns new EVM builder
fn evm(&self) -> EvmBuilder<'static, SetGenericStage, (), EmptyDB> {
Default::default()
}
} Because we're no longer worrying about defining |
cc84e4b
to
0e71257
Compare
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.
we need them to be stateful, so we can capture additional state for precompiles etc.
11aeea4
to
5068549
Compare
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.
small nits
f49fd8c
to
14ee329
Compare
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.
This should unblock us.
then we can figure out how to make the blockexecutor work.
feel free to close this PR and submit it as your own, can't approve myself.
/// Returns new EVM with the given database | ||
fn evm<'a, DB: Database + 'a>(&self, db: DB) -> Evm<'a, (), DB> { | ||
EvmBuilder::default().with_db(db).build() | ||
} | ||
|
||
/// Returns a new EVM with the given inspector |
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.
I'd like a few more docs here wrt what the responsibilities of the caller are: env config
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.
ah forgot to push these changes before merging, will add in another PR
/// Returns new EVM with the given database | ||
fn evm<'a, DB: Database + 'a>(&self, db: DB) -> Evm<'a, (), DB> { |
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.
we can add one more fn that also accepts the Handler type as arg
Co-authored-by: Oliver Nordbjerg <onbjerg@users.noreply.github.com>
fc740a6
to
cd88653
Compare
@mattsse handler method is blocked on bluealloy/revm#1124 - going to merge this, so we can work on the handler method and evm processor / executor factory refactor separately |
closes #6180