diff --git a/src/storage/on_disk.rs b/src/storage/on_disk.rs
index fe8df308..47daed41 100644
--- a/src/storage/on_disk.rs
+++ b/src/storage/on_disk.rs
@@ -7,11 +7,13 @@ use reth_libmdbx::{Database, Environment, Transaction, RO};
use super::{AccountBasic, EvmCode, Storage};
+type PackedAccount = (B256, U256, u64);
+
/// A storage that reads data from an on-disk MDBX database.
#[derive(Debug)]
pub struct OnDiskStorage {
env: Environment,
- cache_encoded_accounts: DashMap
>,
+ cache_encoded_accounts: DashMap>,
cache_storage: DashMap<(Address, U256), U256>,
cache_bytecodes: DashMap>,
cache_block_hashes: DashMap,
@@ -49,7 +51,7 @@ impl OnDiskStorage {
fn load_encoded_account(
&self,
address: Address,
- ) -> Result>, reth_libmdbx::Error> {
+ ) -> Result>, reth_libmdbx::Error> {
match self.cache_encoded_accounts.entry(address) {
Entry::Occupied(occupied) => Ok(occupied),
Entry::Vacant(vacant) => {
@@ -62,11 +64,11 @@ impl OnDiskStorage {
.get(self.table_encoded_accounts.dbi(), address.as_ref())?;
drop(tx_ref);
- let decoded = bytes.map(|bytes| {
- let b = B256::from_slice(&bytes[0..32]);
- let n = B64::from_slice(&bytes[32..(32 + 8)]);
- let c = B256::from_slice(&bytes[(32 + 8)..(32 + 8 + 32)]);
- (b, n, c)
+ let decoded: Option = bytes.map(|bytes| {
+ let c = B256::from_slice(&bytes[0..32]);
+ let b = B256::from_slice(&bytes[32..64]).into();
+ let n = B64::from_slice(&bytes[64..]).into();
+ (c, b, n)
});
Ok(vacant.insert_entry(decoded))
}
@@ -80,8 +82,8 @@ impl Storage for OnDiskStorage {
fn basic(&self, address: &Address) -> Result