feat: add impl From BlockExecutionOutput for ExecutionOutcome (#10507)

This commit is contained in:
nk_ysg
2024-08-26 02:25:27 +08:00
committed by GitHub
parent dfcfe8d271
commit 5254f16e07
7 changed files with 33 additions and 44 deletions

View File

@ -15,7 +15,7 @@ use reth_cli_runner::CliContext;
use reth_consensus::Consensus;
use reth_db::DatabaseEnv;
use reth_errors::RethResult;
use reth_evm::execute::{BlockExecutionOutput, BlockExecutorProvider, Executor};
use reth_evm::execute::{BlockExecutorProvider, Executor};
use reth_execution_types::ExecutionOutcome;
use reth_fs_util as fs;
use reth_node_api::PayloadBuilderAttributes;
@ -273,15 +273,10 @@ impl Command {
let db = StateProviderDatabase::new(blockchain_db.latest()?);
let executor = block_executor!(provider_factory.chain_spec()).executor(db);
let BlockExecutionOutput { state, receipts, requests, .. } =
let block_execution_output =
executor.execute((&block_with_senders.clone().unseal(), U256::MAX).into())?;
let execution_outcome = ExecutionOutcome::new(
state,
receipts.into(),
block.number,
vec![requests.into()],
);
let execution_outcome =
ExecutionOutcome::from((block_execution_output, block.number));
debug!(target: "reth::cli", ?execution_outcome, "Executed block");
let hashed_post_state = execution_outcome.hash_state_slow();

View File

@ -10,7 +10,7 @@ use reth_cli_util::get_secret_key;
use reth_config::Config;
use reth_db::DatabaseEnv;
use reth_errors::BlockValidationError;
use reth_evm::execute::{BlockExecutionOutput, BlockExecutorProvider, Executor};
use reth_evm::execute::{BlockExecutorProvider, Executor};
use reth_execution_types::ExecutionOutcome;
use reth_network::{BlockDownloaderProvider, NetworkHandle};
use reth_network_api::NetworkInfo;
@ -136,7 +136,7 @@ impl Command {
let merkle_block_td =
provider.header_td_by_number(merkle_block_number)?.unwrap_or_default();
let BlockExecutionOutput { state, receipts, requests, .. } = executor.execute(
let block_execution_output = executor.execute(
(
&block
.clone()
@ -147,8 +147,7 @@ impl Command {
)
.into(),
)?;
let execution_outcome =
ExecutionOutcome::new(state, receipts.into(), block.number, vec![requests.into()]);
let execution_outcome = ExecutionOutcome::from((block_execution_output, block.number));
// Unpacked `BundleState::state_root_slow` function
let (in_memory_state_root, in_memory_updates) = StateRoot::overlay_root_with_updates(