mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: add Evm trait (#13823)
This commit is contained in:
@ -6,14 +6,13 @@ use pretty_assertions::Comparison;
|
||||
use reth_chainspec::{EthChainSpec, EthereumHardforks};
|
||||
use reth_engine_primitives::InvalidBlockHook;
|
||||
use reth_evm::{
|
||||
state_change::post_block_balance_increments, system_calls::SystemCaller, ConfigureEvm,
|
||||
state_change::post_block_balance_increments, system_calls::SystemCaller, ConfigureEvm, Evm,
|
||||
};
|
||||
use reth_primitives::{NodePrimitives, RecoveredBlock, SealedHeader};
|
||||
use reth_primitives_traits::{BlockBody, SignedTransaction};
|
||||
use reth_provider::{BlockExecutionOutput, ChainSpecProvider, StateProviderFactory};
|
||||
use reth_revm::{
|
||||
database::StateProviderDatabase, db::states::bundle_state::BundleRetention, DatabaseCommit,
|
||||
StateBuilder,
|
||||
database::StateProviderDatabase, db::states::bundle_state::BundleRetention, StateBuilder,
|
||||
};
|
||||
use reth_rpc_api::DebugApiClient;
|
||||
use reth_tracing::tracing::warn;
|
||||
@ -88,13 +87,8 @@ where
|
||||
// Re-execute all of the transactions in the block to load all touched accounts into
|
||||
// the cache DB.
|
||||
for tx in block.body().transactions() {
|
||||
self.evm_config.fill_tx_env(
|
||||
evm.tx_mut(),
|
||||
tx,
|
||||
tx.recover_signer().ok_or_eyre("failed to recover sender")?,
|
||||
);
|
||||
let result = evm.transact()?;
|
||||
evm.db_mut().commit(result.state);
|
||||
let signer = tx.recover_signer().ok_or_eyre("failed to recover sender")?;
|
||||
evm.transact_commit(self.evm_config.tx_env(tx, signer))?;
|
||||
}
|
||||
|
||||
drop(evm);
|
||||
|
||||
@ -15,7 +15,7 @@ use reth_errors::{BlockExecutionError, BlockValidationError, RethError, RethResu
|
||||
use reth_ethereum_forks::EthereumHardforks;
|
||||
use reth_evm::{
|
||||
state_change::post_block_withdrawals_balance_increments, system_calls::SystemCaller,
|
||||
ConfigureEvm,
|
||||
ConfigureEvm, Evm,
|
||||
};
|
||||
use reth_payload_validator::ExecutionPayloadValidator;
|
||||
use reth_primitives::{
|
||||
@ -325,8 +325,8 @@ where
|
||||
let tx_recovered = tx.clone().try_into_ecrecovered().map_err(|_| {
|
||||
BlockExecutionError::Validation(BlockValidationError::SenderRecoveryError)
|
||||
})?;
|
||||
evm_config.fill_tx_env(evm.tx_mut(), &tx_recovered, tx_recovered.signer());
|
||||
let exec_result = match evm.transact() {
|
||||
let tx_env = evm_config.tx_env(&tx_recovered, tx_recovered.signer());
|
||||
let exec_result = match evm.transact(tx_env) {
|
||||
Ok(result) => result,
|
||||
error @ Err(EVMError::Transaction(_) | EVMError::Header(_)) => {
|
||||
trace!(target: "engine::stream::reorg", hash = %tx.tx_hash(), ?error, "Error executing transaction from next block");
|
||||
|
||||
Reference in New Issue
Block a user