Skip to content

Commit b8fa08f

Browse files
klkvrmattsse
andauthored
chore: remove StateRoot variant from BlockValidationError (paradigmxyz#14858)
Co-authored-by: Matthias Seitz <[email protected]>
1 parent e5720e6 commit b8fa08f

File tree

5 files changed

+6
-23
lines changed

5 files changed

+6
-23
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/evm/execution-errors/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ alloy-primitives.workspace = true
1919
alloy-rlp.workspace = true
2020
nybbles.workspace = true
2121

22-
revm-database-interface.workspace = true
23-
2422
thiserror.workspace = true
2523

2624
[features]
@@ -30,7 +28,6 @@ std = [
3028
"alloy-rlp/std",
3129
"thiserror/std",
3230
"nybbles/std",
33-
"revm-database-interface/std",
3431
"reth-storage-errors/std",
3532
"alloy-evm/std",
3633
]

crates/evm/execution-errors/src/lib.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ pub enum BlockValidationError {
3737
/// Error when incrementing balance in post execution
3838
#[error("incrementing balance in post execution failed")]
3939
IncrementBalanceFailed,
40-
/// Error when the state root does not match the expected value.
41-
#[error(transparent)]
42-
StateRoot(#[from] StateRootError),
4340
/// Error when transaction gas limit exceeds available block gas
4441
#[error(
4542
"transaction gas limit {transaction_gas_limit} is more than blocks available gas {block_available_gas}"
@@ -137,11 +134,6 @@ impl BlockExecutionError {
137134
}
138135
}
139136

140-
/// Returns `true` if the error is a state root error.
141-
pub const fn is_state_root_error(&self) -> bool {
142-
matches!(self, Self::Validation(BlockValidationError::StateRoot(_)))
143-
}
144-
145137
/// Handles an EVM error occurred when executing a transaction.
146138
///
147139
/// If an error matches [`EvmError::InvalidTransaction`], it will be wrapped into
@@ -164,8 +156,6 @@ impl From<ProviderError> for BlockExecutionError {
164156
}
165157
}
166158

167-
impl revm_database_interface::DBErrorMarker for BlockExecutionError {}
168-
169159
/// Internal (i.e., not validation or consensus related) `BlockExecutor` Errors
170160
#[derive(Error, Debug)]
171161
pub enum InternalBlockExecutionError {

crates/evm/src/execute.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ mod tests {
700700
use core::marker::PhantomData;
701701
use reth_primitives::EthPrimitives;
702702
use revm::state::AccountInfo;
703-
use revm_database::{CacheDB, EmptyDBTyped};
703+
use revm_database::{CacheDB, EmptyDB};
704704

705705
#[derive(Clone, Default)]
706706
struct TestExecutorProvider;
@@ -754,7 +754,7 @@ mod tests {
754754
#[test]
755755
fn test_provider() {
756756
let provider = TestExecutorProvider;
757-
let db = CacheDB::<EmptyDBTyped<ProviderError>>::default();
757+
let db = CacheDB::<EmptyDB>::default();
758758
let executor = provider.executor(db);
759759
let _ = executor.execute(&Default::default());
760760
}
@@ -763,8 +763,8 @@ mod tests {
763763
addr: Address,
764764
balance: u128,
765765
nonce: u64,
766-
) -> State<CacheDB<EmptyDBTyped<BlockExecutionError>>> {
767-
let db = CacheDB::<EmptyDBTyped<BlockExecutionError>>::default();
766+
) -> State<CacheDB<EmptyDB>> {
767+
let db = CacheDB::<EmptyDB>::default();
768768
let mut state = State::builder().with_database(db).with_bundle_update().build();
769769

770770
let account_info = AccountInfo {
@@ -792,7 +792,7 @@ mod tests {
792792
#[test]
793793
fn test_balance_increment_state_empty_increments_map() {
794794
let mut state = State::builder()
795-
.with_database(CacheDB::<EmptyDBTyped<BlockExecutionError>>::default())
795+
.with_database(CacheDB::<EmptyDB>::default())
796796
.with_bundle_update()
797797
.build();
798798

crates/stages/api/src/error.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ pub enum BlockErrorKind {
2323
impl BlockErrorKind {
2424
/// Returns `true` if the error is a state root error.
2525
pub const fn is_state_root_error(&self) -> bool {
26-
match self {
27-
Self::Validation(err) => err.is_state_root_error(),
28-
Self::Execution(err) => err.is_state_root_error(),
29-
}
26+
matches!(self, Self::Validation(err) if err.is_state_root_error())
3027
}
3128
}
3229

0 commit comments

Comments
 (0)