chore: remove StateRoot variant from BlockValidationError (#14858)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Arsenii Kulikov
2025-03-06 11:23:26 +04:00
committed by GitHub
parent e5720e6d0d
commit b8fa08f452
5 changed files with 6 additions and 23 deletions

1
Cargo.lock generated
View File

@@ -7841,7 +7841,6 @@ dependencies = [
"alloy-rlp",
"nybbles",
"reth-storage-errors",
"revm-database-interface",
"thiserror 2.0.12",
]

View File

@@ -19,8 +19,6 @@ alloy-primitives.workspace = true
alloy-rlp.workspace = true
nybbles.workspace = true
revm-database-interface.workspace = true
thiserror.workspace = true
[features]
@@ -30,7 +28,6 @@ std = [
"alloy-rlp/std",
"thiserror/std",
"nybbles/std",
"revm-database-interface/std",
"reth-storage-errors/std",
"alloy-evm/std",
]

View File

@@ -37,9 +37,6 @@ pub enum BlockValidationError {
/// Error when incrementing balance in post execution
#[error("incrementing balance in post execution failed")]
IncrementBalanceFailed,
/// Error when the state root does not match the expected value.
#[error(transparent)]
StateRoot(#[from] StateRootError),
/// Error when transaction gas limit exceeds available block gas
#[error(
"transaction gas limit {transaction_gas_limit} is more than blocks available gas {block_available_gas}"
@@ -137,11 +134,6 @@ impl BlockExecutionError {
}
}
/// Returns `true` if the error is a state root error.
pub const fn is_state_root_error(&self) -> bool {
matches!(self, Self::Validation(BlockValidationError::StateRoot(_)))
}
/// Handles an EVM error occurred when executing a transaction.
///
/// If an error matches [`EvmError::InvalidTransaction`], it will be wrapped into
@@ -164,8 +156,6 @@ impl From<ProviderError> for BlockExecutionError {
}
}
impl revm_database_interface::DBErrorMarker for BlockExecutionError {}
/// Internal (i.e., not validation or consensus related) `BlockExecutor` Errors
#[derive(Error, Debug)]
pub enum InternalBlockExecutionError {

View File

@@ -700,7 +700,7 @@ mod tests {
use core::marker::PhantomData;
use reth_primitives::EthPrimitives;
use revm::state::AccountInfo;
use revm_database::{CacheDB, EmptyDBTyped};
use revm_database::{CacheDB, EmptyDB};
#[derive(Clone, Default)]
struct TestExecutorProvider;
@@ -754,7 +754,7 @@ mod tests {
#[test]
fn test_provider() {
let provider = TestExecutorProvider;
let db = CacheDB::<EmptyDBTyped<ProviderError>>::default();
let db = CacheDB::<EmptyDB>::default();
let executor = provider.executor(db);
let _ = executor.execute(&Default::default());
}
@@ -763,8 +763,8 @@ mod tests {
addr: Address,
balance: u128,
nonce: u64,
) -> State<CacheDB<EmptyDBTyped<BlockExecutionError>>> {
let db = CacheDB::<EmptyDBTyped<BlockExecutionError>>::default();
) -> State<CacheDB<EmptyDB>> {
let db = CacheDB::<EmptyDB>::default();
let mut state = State::builder().with_database(db).with_bundle_update().build();
let account_info = AccountInfo {
@@ -792,7 +792,7 @@ mod tests {
#[test]
fn test_balance_increment_state_empty_increments_map() {
let mut state = State::builder()
.with_database(CacheDB::<EmptyDBTyped<BlockExecutionError>>::default())
.with_database(CacheDB::<EmptyDB>::default())
.with_bundle_update()
.build();

View File

@@ -23,10 +23,7 @@ pub enum BlockErrorKind {
impl BlockErrorKind {
/// Returns `true` if the error is a state root error.
pub const fn is_state_root_error(&self) -> bool {
match self {
Self::Validation(err) => err.is_state_root_error(),
Self::Execution(err) => err.is_state_root_error(),
}
matches!(self, Self::Validation(err) if err.is_state_root_error())
}
}