diff --git a/crates/revm/src/db/in_memory_db.rs b/crates/revm/src/db/in_memory_db.rs index f1d24bdee7..4ccd2780a6 100644 --- a/crates/revm/src/db/in_memory_db.rs +++ b/crates/revm/src/db/in_memory_db.rs @@ -36,11 +36,11 @@ pub struct CacheDB { /// `code` is always `None`, and bytecode can be found in `contracts`. pub accounts: DbMap, /// Tracks all contracts by their code hash. - pub contracts: DbMap, + pub contracts: HashMap, /// All logs that were committed via [DatabaseCommit::commit]. pub logs: Vec, /// All cached block hashes from the [DatabaseRef]. - pub block_hashes: DbMap, + pub block_hashes: HashMap, /// The underlying database ([DatabaseRef]) that is used to load data. /// /// Note: this is read-only, data is never written to this database. @@ -55,7 +55,7 @@ impl Default for CacheDB { impl CacheDB { pub fn new(db: ExtDB) -> Self { - let mut contracts = DbMap::new(); + let mut contracts = HashMap::new(); cfg_if::cfg_if! { if #[cfg(not(feature = "scroll"))] { contracts.insert(KECCAK_EMPTY, Bytecode::default()); @@ -68,7 +68,7 @@ impl CacheDB { accounts: DbMap::new(), contracts, logs: Vec::default(), - block_hashes: DbMap::new(), + block_hashes: HashMap::new(), db, } } @@ -216,8 +216,8 @@ impl Database for CacheDB { fn code_by_hash(&mut self, code_hash: B256) -> Result { match self.contracts.entry(code_hash) { - DbMapEntry::Occupied(entry) => Ok(entry.get().clone()), - DbMapEntry::Vacant(entry) => { + Entry::Occupied(entry) => Ok(entry.get().clone()), + Entry::Vacant(entry) => { // if you return code bytes when basic fn is called this function is not needed. Ok(entry.insert(self.db.code_by_hash_ref(code_hash)?).clone()) } @@ -266,8 +266,8 @@ impl Database for CacheDB { fn block_hash(&mut self, number: u64) -> Result { match self.block_hashes.entry(U256::from(number)) { - DbMapEntry::Occupied(entry) => Ok(*entry.get()), - DbMapEntry::Vacant(entry) => { + Entry::Occupied(entry) => Ok(*entry.get()), + Entry::Vacant(entry) => { let hash = self.db.block_hash_ref(number)?; entry.insert(hash); Ok(hash)