diff --git a/crates/revm/src/db/in_memory_db.rs b/crates/revm/src/db/in_memory_db.rs index d7e435548f..bca142e3ae 100644 --- a/crates/revm/src/db/in_memory_db.rs +++ b/crates/revm/src/db/in_memory_db.rs @@ -19,7 +19,7 @@ pub type InMemoryDB = CacheDB; /// The [DbAccount] holds the code hash of the contract, which is used to look up the contract in the `contracts` map. #[derive(Debug, Clone)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct CacheDB { +pub struct CacheDB { /// Account info where None means it is not existing. Not existing state is needed for Pre TANGERINE forks. /// `code` is always `None`, and bytecode can be found in `contracts`. pub accounts: HashMap, @@ -35,13 +35,13 @@ pub struct CacheDB { pub db: ExtDB, } -impl Default for CacheDB { +impl Default for CacheDB { fn default() -> Self { Self::new(ExtDB::default()) } } -impl CacheDB { +impl CacheDB { pub fn new(db: ExtDB) -> Self { let mut contracts = HashMap::new(); contracts.insert(KECCAK_EMPTY, Bytecode::new()); @@ -81,7 +81,9 @@ impl CacheDB { self.insert_contract(&mut info); self.accounts.entry(address).or_default().info = info; } +} +impl CacheDB { /// Returns the account for the given address. /// /// If the account was not found in the cache, it will be loaded from the underlying database. @@ -125,7 +127,7 @@ impl CacheDB { } } -impl DatabaseCommit for CacheDB { +impl DatabaseCommit for CacheDB { fn commit(&mut self, changes: HashMap) { for (address, mut account) in changes { if !account.is_touched() {