mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
refactor: BlockExecutionStrategy API (#14480)
This commit is contained in:
@ -8,7 +8,6 @@ use reth_evm::{
|
||||
state_change::post_block_balance_increments, system_calls::SystemCaller, ConfigureEvmFor, Evm,
|
||||
};
|
||||
use reth_primitives::{NodePrimitives, RecoveredBlock, SealedHeader};
|
||||
use reth_primitives_traits::{BlockBody, SignedTransaction};
|
||||
use reth_provider::{BlockExecutionOutput, ChainSpecProvider, StateProviderFactory};
|
||||
use reth_revm::{
|
||||
database::StateProviderDatabase,
|
||||
@ -85,10 +84,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() {
|
||||
let signer =
|
||||
tx.recover_signer().map_err(|_| eyre::eyre!("failed to recover sender"))?;
|
||||
evm.transact_commit(self.evm_config.tx_env(tx, signer))?;
|
||||
for tx in block.transactions_recovered() {
|
||||
evm.transact_commit(self.evm_config.tx_env(tx))?;
|
||||
}
|
||||
|
||||
drop(evm);
|
||||
|
||||
@ -2775,7 +2775,7 @@ where
|
||||
let mut evm = evm_config.evm_with_env(state_provider, evm_env);
|
||||
|
||||
// create the tx env and reset nonce
|
||||
let tx_env = evm_config.tx_env(&tx, tx.signer());
|
||||
let tx_env = evm_config.tx_env(&tx);
|
||||
|
||||
// exit early if execution is done
|
||||
if cancel_execution.is_cancelled() {
|
||||
|
||||
@ -312,7 +312,7 @@ where
|
||||
// Configure the environment for the block.
|
||||
let tx_recovered =
|
||||
tx.try_clone_into_recovered().map_err(|_| ProviderError::SenderRecoveryError)?;
|
||||
let tx_env = evm_config.tx_env(&tx_recovered, tx_recovered.signer());
|
||||
let tx_env = evm_config.tx_env(tx_recovered);
|
||||
let exec_result = match evm.transact(tx_env) {
|
||||
Ok(result) => result,
|
||||
Err(err) if err.is_invalid_tx_err() => {
|
||||
|
||||
Reference in New Issue
Block a user