Skip to content
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(witness): use block executor to execute block inside debug_execution_witness #10736

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions crates/ethereum/evm/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use reth_revm::{
BundleAccount, State,
},
state_change::post_block_balance_increments,
Evm,
Evm, State
};
use revm_primitives::{
db::{Database, DatabaseCommit},
Expand Down Expand Up @@ -382,7 +382,13 @@ where
// NOTE: we need to merge keep the reverts for the bundle retention
self.state.merge_transitions(BundleRetention::Reverts);

Ok(BlockExecutionOutput { state: self.state.take_bundle(), receipts, requests, gas_used })
Ok(BlockExecutionOutput {
state: self.state.take_bundle(),
cache: core::mem::take(&mut self.state.cache),
0x00101010 marked this conversation as resolved.
Show resolved Hide resolved
receipts,
requests,
gas_used,
})
}
}

Expand Down
4 changes: 3 additions & 1 deletion crates/evm/execution-types/src/execute.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use reth_primitives::{Request, U256};
use revm::db::BundleState;
use revm::{db::BundleState, CacheState};

/// A helper type for ethereum block inputs that consists of a block and the total difficulty.
#[derive(Debug)]
Expand Down Expand Up @@ -30,6 +30,8 @@ impl<'a, Block> From<(&'a Block, U256)> for BlockExecutionInput<'a, Block> {
pub struct BlockExecutionOutput<T> {
/// The changed state of the block after execution.
pub state: BundleState,
/// cache state of the block after execution.
pub cache: CacheState,
/// All the receipts of the transactions in the block.
pub receipts: Vec<T>,
/// All the EIP-7685 requests of the transactions in the block.
Expand Down
1 change: 1 addition & 0 deletions crates/evm/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ impl<DB> Executor<DB> for MockExecutorProvider {
self.exec_results.lock().pop().unwrap();
Ok(BlockExecutionOutput {
state: bundle,
cache: Default::default(),
receipts: receipts.into_iter().flatten().flatten().collect(),
requests: requests.into_iter().flatten().collect(),
gas_used: 0,
Expand Down
3 changes: 3 additions & 0 deletions crates/node/builder/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ pub struct RpcRegistry<Node: FullNodeComponents, EthApi: EthApiTypes> {
TaskExecutor,
Node::Provider,
EthApi,
Node::Executor,
>,
}

Expand All @@ -207,6 +208,7 @@ where
TaskExecutor,
Node::Provider,
EthApi,
Node::Executor,
>;

fn deref(&self) -> &Self::Target {
Expand Down Expand Up @@ -322,6 +324,7 @@ where
.with_events(node.provider().clone())
.with_executor(node.task_executor().clone())
.with_evm_config(node.evm_config().clone())
.with_block_executor(node.block_executor().clone())
.build_with_auth_server(module_config, engine_api, EthApi::eth_api_builder());

let mut registry = RpcRegistry { registry };
Expand Down
1 change: 1 addition & 0 deletions crates/optimism/evm/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ where

Ok(BlockExecutionOutput {
state: self.state.take_bundle(),
cache: core::mem::take(&mut self.state.cache),
receipts,
requests: vec![],
gas_used,
Expand Down
Loading