reth_evm/test_utils.rs
1//! Helpers for testing.
2
3use crate::execute::BasicBlockExecutor;
4use revm::database::State;
5
6impl<Factory, DB> BasicBlockExecutor<Factory, DB> {
7 /// Provides safe read access to the state
8 pub fn with_state<F, R>(&self, f: F) -> R
9 where
10 F: FnOnce(&State<DB>) -> R,
11 {
12 f(&self.db)
13 }
14
15 /// Provides safe write access to the state
16 pub fn with_state_mut<F, R>(&mut self, f: F) -> R
17 where
18 F: FnOnce(&mut State<DB>) -> R,
19 {
20 f(&mut self.db)
21 }
22}