mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-02-18 18:54:35 -05:00
convert ``OptimismBlockExecution`` error variant into a general purpose error variant (#8100)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
//! Optimism block executor.
|
||||
|
||||
use crate::{l1::ensure_create2_deployer, verify::verify_receipts, OptimismEvmConfig};
|
||||
use crate::{
|
||||
l1::ensure_create2_deployer, verify::verify_receipts, OptimismBlockExecutionError,
|
||||
OptimismEvmConfig,
|
||||
};
|
||||
use reth_evm::{
|
||||
execute::{
|
||||
BatchBlockExecutionOutput, BatchExecutor, BlockExecutionInput, BlockExecutionOutput,
|
||||
@@ -9,7 +12,7 @@ use reth_evm::{
|
||||
ConfigureEvm, ConfigureEvmEnv,
|
||||
};
|
||||
use reth_interfaces::{
|
||||
executor::{BlockExecutionError, BlockValidationError, OptimismBlockExecutionError},
|
||||
executor::{BlockExecutionError, BlockValidationError},
|
||||
provider::ProviderError,
|
||||
};
|
||||
use reth_primitives::{
|
||||
@@ -141,13 +144,8 @@ where
|
||||
// blocks will always have at least a single transaction in them (the L1 info transaction),
|
||||
// so we can safely assume that this will always be triggered upon the transition and that
|
||||
// the above check for empty blocks will never be hit on OP chains.
|
||||
ensure_create2_deployer(self.chain_spec.clone(), block.timestamp, evm.db_mut()).map_err(
|
||||
|_| {
|
||||
BlockExecutionError::OptimismBlockExecution(
|
||||
OptimismBlockExecutionError::ForceCreate2DeployerFail,
|
||||
)
|
||||
},
|
||||
)?;
|
||||
ensure_create2_deployer(self.chain_spec.clone(), block.timestamp, evm.db_mut())
|
||||
.map_err(|_| OptimismBlockExecutionError::ForceCreate2DeployerFail)?;
|
||||
|
||||
let mut cumulative_gas_used = 0;
|
||||
let mut receipts = Vec::with_capacity(block.body.len());
|
||||
@@ -167,9 +165,7 @@ where
|
||||
|
||||
// An optimism block should never contain blob transactions.
|
||||
if matches!(transaction.tx_type(), TxType::Eip4844) {
|
||||
return Err(BlockExecutionError::OptimismBlockExecution(
|
||||
OptimismBlockExecutionError::BlobTransactionRejected,
|
||||
));
|
||||
return Err(OptimismBlockExecutionError::BlobTransactionRejected.into());
|
||||
}
|
||||
|
||||
// Cache the depositor account prior to the state transition for the deposit nonce.
|
||||
@@ -184,11 +180,7 @@ where
|
||||
.map(|acc| acc.account_info().unwrap_or_default())
|
||||
})
|
||||
.transpose()
|
||||
.map_err(|_| {
|
||||
BlockExecutionError::OptimismBlockExecution(
|
||||
OptimismBlockExecutionError::AccountLoadFailed(*sender),
|
||||
)
|
||||
})?;
|
||||
.map_err(|_| OptimismBlockExecutionError::AccountLoadFailed(*sender))?;
|
||||
|
||||
let mut buf = Vec::with_capacity(transaction.length_without_header());
|
||||
transaction.encode_enveloped(&mut buf);
|
||||
|
||||
Reference in New Issue
Block a user