-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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-ethereum): add BlockAccessListExecutor #10849
Conversation
6825a17
to
4e89479
Compare
crates/ethereum/evm/src/execute.rs
Outdated
for (address, account) in self.executor.state.cache.accounts { | ||
if let Entry::Vacant(entry) = bundle_state.state.entry(address) { |
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.
bundle state only stores changed slots. so if account or some slots were changed, accessed unchanged slots will not be written back to bundle state
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 right, added a match here with the occupied branch adding unchanged slots, lmk what you think
// NOTE: we need to merge keep the reverts for the bundle retention | ||
self.executor.state.merge_transitions(BundleRetention::Reverts); | ||
|
||
// now, ensure each account from the state is included in the bundle state |
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.
Below code basically need to be implemented again in crates/optimism/evm/src/execute.rs
as well, not a big deal, but wonder if we can extract them somewhere?
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.
Hm, let me think about it, it might be possible to make this reusable across both
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.
Couldn't figure out something nice, will just copy the implementation since it's one method and it's simple
@@ -384,6 +390,71 @@ where | |||
} | |||
} | |||
|
|||
/// An executor that retains all cache state from execution in its bundle state. | |||
#[derive(Debug)] | |||
pub struct BlockAccessListExecutor<EvmConfig, 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.
Currently we're reading from node components to get the block_executor_provider
out, if we're gonna have another executor, are we ok with adding another method maybe called access_list_executor?
On the other side, here's the aforementioned version of code that changes fn execute(self, xxx)
to fn execute(&mut self, xxx)
: https://github.com/paradigmxyz/reth/pull/10736/files#diff-eb5f2c91d277e8bdf71850182110f34c23bcb1d70a675f570572f18af090a1d1R33
It works, just need to change bunch of places to let mut executor
which I'm not sure if we're ok with
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.
yes, I think we will add another associated type and method to BlockExecutorProvider
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.
#10868 tracking here
4e89479
to
df9a0e2
Compare
Would like review on this impl, before I copy it over to optimism as well |
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.
LGTM
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.
lgtm
Introduces a new executor type that includes the
CacheState
in the returnedBundleState
during execution. This should make it easier to integrate the block executor into e.g.debug_executionWitness
without changing the normal execution code paths.