feat(reth-evm-ethereum): use EVMError::map_db_err (#10916)

Co-authored-by: Emilia Hane <elsaemiliaevahane@gmail.com>
This commit is contained in:
nk_ysg
2024-09-17 06:55:40 +08:00
committed by GitHub
parent bf800986d3
commit 0fd8132e90
2 changed files with 4 additions and 16 deletions

View File

@ -35,7 +35,7 @@ use reth_revm::{
};
use revm_primitives::{
db::{Database, DatabaseCommit},
BlockEnv, CfgEnvWithHandlerCfg, EVMError, EnvWithHandlerCfg, ResultAndState,
BlockEnv, CfgEnvWithHandlerCfg, EnvWithHandlerCfg, ResultAndState,
};
use std::collections::hash_map::Entry;
@ -184,13 +184,7 @@ where
// Execute transaction.
let ResultAndState { result, state } = evm.transact().map_err(move |err| {
let new_err = match err {
EVMError::Transaction(e) => EVMError::Transaction(e),
EVMError::Header(e) => EVMError::Header(e),
EVMError::Database(e) => EVMError::Database(e.into()),
EVMError::Custom(e) => EVMError::Custom(e),
EVMError::Precompile(e) => EVMError::Precompile(e),
};
let new_err = err.map_db_err(|e| e.into());
// Ensure hash is calculated for error log, if not already done
BlockValidationError::EVM {
hash: transaction.recalculate_hash(),

View File

@ -28,7 +28,7 @@ use reth_revm::{
};
use revm_primitives::{
db::{Database, DatabaseCommit},
BlockEnv, CfgEnvWithHandlerCfg, EVMError, EnvWithHandlerCfg, ResultAndState,
BlockEnv, CfgEnvWithHandlerCfg, EnvWithHandlerCfg, ResultAndState,
};
use std::{collections::hash_map::Entry, fmt::Display, sync::Arc};
use tracing::trace;
@ -186,13 +186,7 @@ where
// Execute transaction.
let ResultAndState { result, state } = evm.transact().map_err(move |err| {
let new_err = match err {
EVMError::Transaction(e) => EVMError::Transaction(e),
EVMError::Header(e) => EVMError::Header(e),
EVMError::Database(e) => EVMError::Database(e.into()),
EVMError::Custom(e) => EVMError::Custom(e),
EVMError::Precompile(e) => EVMError::Precompile(e),
};
let new_err = err.map_db_err(|e| e.into());
// Ensure hash is calculated for error log, if not already done
BlockValidationError::EVM {
hash: transaction.recalculate_hash(),