diff --git a/crates/katana/storage/provider/src/providers/db/mod.rs b/crates/katana/storage/provider/src/providers/db/mod.rs index 47876600a3..749ffd807c 100644 --- a/crates/katana/storage/provider/src/providers/db/mod.rs +++ b/crates/katana/storage/provider/src/providers/db/mod.rs @@ -13,13 +13,7 @@ use katana_db::models::contract::{ use katana_db::models::storage::{ ContractStorageEntry, ContractStorageKey, StorageEntry, StorageEntryChangeList, }; -use katana_db::tables::{ - BlockBodyIndices, BlockHashes, BlockNumbers, BlockStatusses, ClassDeclarationBlock, - ClassDeclarations, CompiledClassHashes, CompiledContractClasses, ContractClassChanges, - ContractInfo, ContractInfoChangeSet, ContractStorage, DupSort, Headers, NonceChanges, Receipts, - SierraClasses, StorageChangeSet, StorageChanges, Table, Transactions, TxBlocks, TxHashes, - TxNumbers, -}; +use katana_db::tables::{self, DupSort, Table}; use katana_db::utils::KeyValue; use katana_primitives::block::{ Block, BlockHash, BlockHashOrNumber, BlockNumber, BlockWithTxHashes, FinalityStatus, Header, @@ -91,14 +85,14 @@ impl StateFactoryProvider for DbProvider { impl BlockNumberProvider for DbProvider { fn block_number_by_hash(&self, hash: BlockHash) -> ProviderResult> { let db_tx = self.0.tx()?; - let block_num = db_tx.get::(hash)?; + let block_num = db_tx.get::(hash)?; db_tx.commit()?; Ok(block_num) } fn latest_number(&self) -> ProviderResult { let db_tx = self.0.tx()?; - let res = db_tx.cursor::()?.last()?.map(|(num, _)| num); + let res = db_tx.cursor::()?.last()?.map(|(num, _)| num); let total_blocks = res.ok_or(ProviderError::MissingLatestBlockNumber)?; db_tx.commit()?; Ok(total_blocks) @@ -109,14 +103,14 @@ impl BlockHashProvider for DbProvider { fn latest_hash(&self) -> ProviderResult { let latest_block = self.latest_number()?; let db_tx = self.0.tx()?; - let latest_hash = db_tx.get::(latest_block)?; + let latest_hash = db_tx.get::(latest_block)?; db_tx.commit()?; latest_hash.ok_or(ProviderError::MissingLatestBlockHash) } fn block_hash_by_num(&self, num: BlockNumber) -> ProviderResult> { let db_tx = self.0.tx()?; - let block_hash = db_tx.get::(num)?; + let block_hash = db_tx.get::(num)?; db_tx.commit()?; Ok(block_hash) } @@ -128,12 +122,12 @@ impl HeaderProvider for DbProvider { let num = match id { BlockHashOrNumber::Num(num) => Some(num), - BlockHashOrNumber::Hash(hash) => db_tx.get::(hash)?, + BlockHashOrNumber::Hash(hash) => db_tx.get::(hash)?, }; if let Some(num) = num { let header = - db_tx.get::(num)?.ok_or(ProviderError::MissingBlockHeader(num))?; + db_tx.get::(num)?.ok_or(ProviderError::MissingBlockHeader(num))?; db_tx.commit()?; Ok(Some(header)) } else { @@ -151,11 +145,11 @@ impl BlockProvider for DbProvider { let block_num = match id { BlockHashOrNumber::Num(num) => Some(num), - BlockHashOrNumber::Hash(hash) => db_tx.get::(hash)?, + BlockHashOrNumber::Hash(hash) => db_tx.get::(hash)?, }; if let Some(num) = block_num { - let indices = db_tx.get::(num)?; + let indices = db_tx.get::(num)?; db_tx.commit()?; Ok(indices) } else { @@ -185,13 +179,13 @@ impl BlockProvider for DbProvider { let block_num = match id { BlockHashOrNumber::Num(num) => Some(num), - BlockHashOrNumber::Hash(hash) => db_tx.get::(hash)?, + BlockHashOrNumber::Hash(hash) => db_tx.get::(hash)?, }; let Some(block_num) = block_num else { return Ok(None) }; - if let Some(header) = db_tx.get::(block_num)? { - let res = db_tx.get::(block_num)?; + if let Some(header) = db_tx.get::(block_num)? { + let res = db_tx.get::(block_num)?; let body_indices = res.ok_or(ProviderError::MissingBlockTxs(block_num))?; let body = self.transaction_hashes_in_range(Range::from(body_indices))?; @@ -212,8 +206,8 @@ impl BlockProvider for DbProvider { let mut blocks = Vec::with_capacity(total as usize); for num in range { - if let Some(header) = db_tx.get::(num)? { - let res = db_tx.get::(num)?; + if let Some(header) = db_tx.get::(num)? { + let res = db_tx.get::(num)?; let body_indices = res.ok_or(ProviderError::MissingBlockBodyIndices(num))?; let body = self.transaction_in_range(Range::from(body_indices))?; @@ -236,7 +230,7 @@ impl BlockStatusProvider for DbProvider { }; if let Some(block_num) = block_num { - let res = db_tx.get::(block_num)?; + let res = db_tx.get::(block_num)?; let status = res.ok_or(ProviderError::MissingBlockStatus(block_num))?; db_tx.commit()?; @@ -253,11 +247,11 @@ impl StateRootProvider for DbProvider { let block_num = match block_id { BlockHashOrNumber::Num(num) => Some(num), - BlockHashOrNumber::Hash(hash) => db_tx.get::(hash)?, + BlockHashOrNumber::Hash(hash) => db_tx.get::(hash)?, }; if let Some(block_num) = block_num { - let header = db_tx.get::(block_num)?; + let header = db_tx.get::(block_num)?; db_tx.commit()?; Ok(header.map(|h| h.state_root)) } else { @@ -291,17 +285,17 @@ impl StateUpdateProvider for DbProvider { let block_num = self.block_number_by_id(block_id)?; if let Some(block_num) = block_num { - let nonce_updates = dup_entries::, _>( - &db_tx, - block_num, - |entry| { - let (_, ContractNonceChange { contract_address, nonce }) = entry?; - Ok((contract_address, nonce)) - }, - )?; + let nonce_updates = dup_entries::< + tables::NonceChanges, + HashMap, + _, + >(&db_tx, block_num, |entry| { + let (_, ContractNonceChange { contract_address, nonce }) = entry?; + Ok((contract_address, nonce)) + })?; let contract_updates = dup_entries::< - ContractClassChanges, + tables::ContractClassChanges, HashMap, _, >(&db_tx, block_num, |entry| { @@ -310,14 +304,14 @@ impl StateUpdateProvider for DbProvider { })?; let declared_classes = dup_entries::< - ClassDeclarations, + tables::ClassDeclarations, HashMap, _, >(&db_tx, block_num, |entry| { let (_, class_hash) = entry?; let compiled_hash = db_tx - .get::(class_hash)? + .get::(class_hash)? .ok_or(ProviderError::MissingCompiledClassHash(class_hash))?; Ok((class_hash, compiled_hash)) @@ -325,7 +319,7 @@ impl StateUpdateProvider for DbProvider { let storage_updates = { let entries = dup_entries::< - StorageChanges, + tables::StorageChanges, Vec<(ContractAddress, (StorageKey, StorageValue))>, _, >(&db_tx, block_num, |entry| { @@ -359,8 +353,8 @@ impl TransactionProvider for DbProvider { fn transaction_by_hash(&self, hash: TxHash) -> ProviderResult> { let db_tx = self.0.tx()?; - if let Some(num) = db_tx.get::(hash)? { - let res = db_tx.get::(num)?; + if let Some(num) = db_tx.get::(hash)? { + let res = db_tx.get::(num)?; let transaction = res.ok_or(ProviderError::MissingTx(num))?; let transaction = TxWithHash { hash, transaction }; db_tx.commit()?; @@ -389,8 +383,8 @@ impl TransactionProvider for DbProvider { let mut transactions = Vec::with_capacity(total as usize); for i in range { - if let Some(transaction) = db_tx.get::(i)? { - let res = db_tx.get::(i)?; + if let Some(transaction) = db_tx.get::(i)? { + let res = db_tx.get::(i)?; let hash = res.ok_or(ProviderError::MissingTxHash(i))?; transactions.push(TxWithHash { hash, transaction }); @@ -406,11 +400,11 @@ impl TransactionProvider for DbProvider { hash: TxHash, ) -> ProviderResult> { let db_tx = self.0.tx()?; - if let Some(num) = db_tx.get::(hash)? { + if let Some(num) = db_tx.get::(hash)? { let block_num = - db_tx.get::(num)?.ok_or(ProviderError::MissingTxBlock(num))?; + db_tx.get::(num)?.ok_or(ProviderError::MissingTxBlock(num))?; - let res = db_tx.get::(block_num)?; + let res = db_tx.get::(block_num)?; let block_hash = res.ok_or(ProviderError::MissingBlockHash(num))?; db_tx.commit()?; @@ -432,10 +426,10 @@ impl TransactionProvider for DbProvider { Some(indices) if idx < indices.tx_count => { let num = indices.tx_offset + idx; - let res = db_tx.get::(num)?; + let res = db_tx.get::(num)?; let hash = res.ok_or(ProviderError::MissingTxHash(num))?; - let res = db_tx.get::(num)?; + let res = db_tx.get::(num)?; let transaction = res.ok_or(ProviderError::MissingTx(num))?; db_tx.commit()?; @@ -468,7 +462,7 @@ impl TransactionsProviderExt for DbProvider { let mut hashes = Vec::with_capacity(total as usize); for i in range { - if let Some(hash) = db_tx.get::(i)? { + if let Some(hash) = db_tx.get::(i)? { hashes.push(hash); } } @@ -481,11 +475,11 @@ impl TransactionsProviderExt for DbProvider { impl TransactionStatusProvider for DbProvider { fn transaction_status(&self, hash: TxHash) -> ProviderResult> { let db_tx = self.0.tx()?; - if let Some(tx_num) = db_tx.get::(hash)? { - let res = db_tx.get::(tx_num)?; + if let Some(tx_num) = db_tx.get::(hash)? { + let res = db_tx.get::(tx_num)?; let block_num = res.ok_or(ProviderError::MissingTxBlock(tx_num))?; - let res = db_tx.get::(block_num)?; + let res = db_tx.get::(block_num)?; let status = res.ok_or(ProviderError::MissingBlockStatus(block_num))?; db_tx.commit()?; @@ -499,7 +493,7 @@ impl TransactionStatusProvider for DbProvider { impl ReceiptProvider for DbProvider { fn receipt_by_hash(&self, hash: TxHash) -> ProviderResult> { let db_tx = self.0.tx()?; - if let Some(num) = db_tx.get::(hash)? { + if let Some(num) = db_tx.get::(hash)? { let receipt = db_tx .get::(num)? .ok_or(ProviderError::MissingTxReceipt(num))?; @@ -521,7 +515,7 @@ impl ReceiptProvider for DbProvider { let range = indices.tx_offset..indices.tx_offset + indices.tx_count; for i in range { - if let Some(receipt) = db_tx.get::(i)? { + if let Some(receipt) = db_tx.get::(i)? { receipts.push(receipt); } } @@ -562,47 +556,47 @@ impl BlockWriter for DbProvider { let transactions = block.block.body; let tx_count = transactions.len() as u64; - let tx_offset = db_tx.entries::()? as u64; + let tx_offset = db_tx.entries::()? as u64; let block_body_indices = StoredBlockBodyIndices { tx_offset, tx_count }; - db_tx.put::(block_number, block_hash)?; - db_tx.put::(block_hash, block_number)?; - db_tx.put::(block_number, block.status)?; + db_tx.put::(block_number, block_hash)?; + db_tx.put::(block_hash, block_number)?; + db_tx.put::(block_number, block.status)?; - db_tx.put::(block_number, block_header)?; - db_tx.put::(block_number, block_body_indices)?; + db_tx.put::(block_number, block_header)?; + db_tx.put::(block_number, block_body_indices)?; for (i, (transaction, receipt)) in transactions.into_iter().zip(receipts).enumerate() { let tx_number = tx_offset + i as u64; let tx_hash = transaction.hash; - db_tx.put::(tx_number, tx_hash)?; - db_tx.put::(tx_hash, tx_number)?; - db_tx.put::(tx_number, block_number)?; - db_tx.put::(tx_number, transaction.transaction)?; - db_tx.put::(tx_number, receipt)?; + db_tx.put::(tx_number, tx_hash)?; + db_tx.put::(tx_hash, tx_number)?; + db_tx.put::(tx_number, block_number)?; + db_tx.put::(tx_number, transaction.transaction)?; + db_tx.put::(tx_number, receipt)?; } // insert classes for (class_hash, compiled_hash) in states.state_updates.declared_classes { - db_tx.put::(class_hash, compiled_hash)?; + db_tx.put::(class_hash, compiled_hash)?; - db_tx.put::(class_hash, block_number)?; - db_tx.put::(block_number, class_hash)? + db_tx.put::(class_hash, block_number)?; + db_tx.put::(block_number, class_hash)? } for (hash, compiled_class) in states.declared_compiled_classes { - db_tx.put::(hash, compiled_class.into())?; + db_tx.put::(hash, compiled_class.into())?; } for (class_hash, sierra_class) in states.declared_sierra_classes { - db_tx.put::(class_hash, sierra_class)?; + db_tx.put::(class_hash, sierra_class)?; } // insert storage changes { - let mut storage_cursor = db_tx.cursor::()?; + let mut storage_cursor = db_tx.cursor::()?; for (addr, entries) in states.state_updates.storage_updates { let entries = entries.into_iter().map(|(key, value)| StorageEntry { key, value }); @@ -616,7 +610,7 @@ impl BlockWriter for DbProvider { _ => {} } - let mut change_set_cursor = db_tx.cursor::()?; + let mut change_set_cursor = db_tx.cursor::()?; let new_block_list = match change_set_cursor.seek_by_key_subkey(addr, entry.key)? { Some(StorageEntryChangeList { mut block_list, key }) @@ -643,7 +637,7 @@ impl BlockWriter for DbProvider { let storage_change_sharded_key = ContractStorageKey { contract_address: addr, key: entry.key }; - db_tx.put::( + db_tx.put::( block_number, ContractStorageEntry { key: storage_change_sharded_key, @@ -657,55 +651,57 @@ impl BlockWriter for DbProvider { // update contract info for (addr, class_hash) in states.state_updates.contract_updates { - let value = if let Some(info) = db_tx.get::(addr)? { + let value = if let Some(info) = db_tx.get::(addr)? { GenericContractInfo { class_hash, ..info } } else { GenericContractInfo { class_hash, ..Default::default() } }; - let new_change_set = - if let Some(mut change_set) = db_tx.get::(addr)? { - change_set.class_change_list.push(block_number); - change_set.class_change_list.sort(); - change_set - } else { - ContractInfoChangeList { - class_change_list: vec![block_number], - ..Default::default() - } - }; + let new_change_set = if let Some(mut change_set) = + db_tx.get::(addr)? + { + change_set.class_change_list.push(block_number); + change_set.class_change_list.sort(); + change_set + } else { + ContractInfoChangeList { + class_change_list: vec![block_number], + ..Default::default() + } + }; - db_tx.put::(addr, value)?; + db_tx.put::(addr, value)?; let class_change_key = ContractClassChange { contract_address: addr, class_hash }; - db_tx.put::(block_number, class_change_key)?; - db_tx.put::(addr, new_change_set)?; + db_tx.put::(block_number, class_change_key)?; + db_tx.put::(addr, new_change_set)?; } for (addr, nonce) in states.state_updates.nonce_updates { - let value = if let Some(info) = db_tx.get::(addr)? { + let value = if let Some(info) = db_tx.get::(addr)? { GenericContractInfo { nonce, ..info } } else { GenericContractInfo { nonce, ..Default::default() } }; - let new_change_set = - if let Some(mut change_set) = db_tx.get::(addr)? { - change_set.nonce_change_list.push(block_number); - change_set.nonce_change_list.sort(); - change_set - } else { - ContractInfoChangeList { - nonce_change_list: vec![block_number], - ..Default::default() - } - }; + let new_change_set = if let Some(mut change_set) = + db_tx.get::(addr)? + { + change_set.nonce_change_list.push(block_number); + change_set.nonce_change_list.sort(); + change_set + } else { + ContractInfoChangeList { + nonce_change_list: vec![block_number], + ..Default::default() + } + }; - db_tx.put::(addr, value)?; + db_tx.put::(addr, value)?; let nonce_change_key = ContractNonceChange { contract_address: addr, nonce }; - db_tx.put::(block_number, nonce_change_key)?; - db_tx.put::(addr, new_change_set)?; + db_tx.put::(block_number, nonce_change_key)?; + db_tx.put::(addr, new_change_set)?; } Ok(()) diff --git a/crates/katana/storage/provider/src/providers/db/state.rs b/crates/katana/storage/provider/src/providers/db/state.rs index 1353b39b45..e72b5cfbd1 100644 --- a/crates/katana/storage/provider/src/providers/db/state.rs +++ b/crates/katana/storage/provider/src/providers/db/state.rs @@ -3,11 +3,7 @@ use std::cmp::Ordering; use katana_db::mdbx::{self}; use katana_db::models::contract::ContractInfoChangeList; use katana_db::models::storage::{ContractStorageKey, StorageEntry}; -use katana_db::tables::{ - ClassDeclarationBlock, CompiledClassHashes, CompiledContractClasses, ContractClassChanges, - ContractInfo, ContractInfoChangeSet, ContractStorage, NonceChanges, SierraClasses, - StorageChangeSet, StorageChanges, -}; +use katana_db::tables; use katana_primitives::block::BlockNumber; use katana_primitives::contract::{ ClassHash, CompiledClassHash, CompiledContractClass, ContractAddress, FlattenedSierraClass, @@ -23,12 +19,12 @@ use crate::ProviderResult; impl StateWriter for DbProvider { fn set_nonce(&self, address: ContractAddress, nonce: Nonce) -> ProviderResult<()> { self.0.update(move |db_tx| -> ProviderResult<()> { - let value = if let Some(info) = db_tx.get::(address)? { + let value = if let Some(info) = db_tx.get::(address)? { GenericContractInfo { nonce, ..info } } else { GenericContractInfo { nonce, ..Default::default() } }; - db_tx.put::(address, value)?; + db_tx.put::(address, value)?; Ok(()) })? } @@ -40,7 +36,7 @@ impl StateWriter for DbProvider { storage_value: StorageValue, ) -> ProviderResult<()> { self.0.update(move |db_tx| -> ProviderResult<()> { - let mut cursor = db_tx.cursor::()?; + let mut cursor = db_tx.cursor::()?; let entry = cursor.seek_by_key_subkey(address, storage_key)?; match entry { @@ -61,12 +57,12 @@ impl StateWriter for DbProvider { class_hash: ClassHash, ) -> ProviderResult<()> { self.0.update(move |db_tx| -> ProviderResult<()> { - let value = if let Some(info) = db_tx.get::(address)? { + let value = if let Some(info) = db_tx.get::(address)? { GenericContractInfo { class_hash, ..info } } else { GenericContractInfo { class_hash, ..Default::default() } }; - db_tx.put::(address, value)?; + db_tx.put::(address, value)?; Ok(()) })? } @@ -75,7 +71,7 @@ impl StateWriter for DbProvider { impl ContractClassWriter for DbProvider { fn set_class(&self, hash: ClassHash, class: CompiledContractClass) -> ProviderResult<()> { self.0.update(move |db_tx| -> ProviderResult<()> { - db_tx.put::(hash, class.into())?; + db_tx.put::(hash, class.into())?; Ok(()) })? } @@ -86,7 +82,7 @@ impl ContractClassWriter for DbProvider { compiled_hash: CompiledClassHash, ) -> ProviderResult<()> { self.0.update(move |db_tx| -> ProviderResult<()> { - db_tx.put::(hash, compiled_hash)?; + db_tx.put::(hash, compiled_hash)?; Ok(()) })? } @@ -97,7 +93,7 @@ impl ContractClassWriter for DbProvider { sierra: FlattenedSierraClass, ) -> ProviderResult<()> { self.0.update(move |db_tx| -> ProviderResult<()> { - db_tx.put::(hash, sierra)?; + db_tx.put::(hash, sierra)?; Ok(()) })? } @@ -114,7 +110,7 @@ impl LatestStateProvider { impl ContractClassProvider for LatestStateProvider { fn class(&self, hash: ClassHash) -> ProviderResult> { - let class = self.0.get::(hash)?; + let class = self.0.get::(hash)?; Ok(class.map(CompiledContractClass::from)) } @@ -122,19 +118,19 @@ impl ContractClassProvider for LatestStateProvider { &self, hash: ClassHash, ) -> ProviderResult> { - let hash = self.0.get::(hash)?; + let hash = self.0.get::(hash)?; Ok(hash) } fn sierra_class(&self, hash: ClassHash) -> ProviderResult> { - let class = self.0.get::(hash)?; + let class = self.0.get::(hash)?; Ok(class) } } impl StateProvider for LatestStateProvider { fn nonce(&self, address: ContractAddress) -> ProviderResult> { - let info = self.0.get::(address)?; + let info = self.0.get::(address)?; Ok(info.map(|info| info.nonce)) } @@ -142,7 +138,7 @@ impl StateProvider for LatestStateProvider { &self, address: ContractAddress, ) -> ProviderResult> { - let info = self.0.get::(address)?; + let info = self.0.get::(address)?; Ok(info.map(|info| info.class_hash)) } @@ -151,7 +147,7 @@ impl StateProvider for LatestStateProvider { address: ContractAddress, storage_key: StorageKey, ) -> ProviderResult> { - let mut cursor = self.0.cursor::()?; + let mut cursor = self.0.cursor::()?; let entry = cursor.seek_by_key_subkey(address, storage_key)?; match entry { Some(entry) if entry.key == storage_key => Ok(Some(entry.value)), @@ -215,8 +211,12 @@ impl ContractClassProvider for HistoricalStateProvider { hash: ClassHash, ) -> ProviderResult> { // check that the requested class hash was declared before the pinned block number - if self.tx.get::(hash)?.is_some_and(|num| num <= self.block_number) { - Ok(self.tx.get::(hash)?) + if self + .tx + .get::(hash)? + .is_some_and(|num| num <= self.block_number) + { + Ok(self.tx.get::(hash)?) } else { Ok(None) } @@ -224,7 +224,7 @@ impl ContractClassProvider for HistoricalStateProvider { fn class(&self, hash: ClassHash) -> ProviderResult> { if self.compiled_class_hash_of_class_hash(hash)?.is_some() { - let contract = self.tx.get::(hash)?; + let contract = self.tx.get::(hash)?; Ok(contract.map(CompiledContractClass::from)) } else { Ok(None) @@ -233,7 +233,7 @@ impl ContractClassProvider for HistoricalStateProvider { fn sierra_class(&self, hash: ClassHash) -> ProviderResult> { if self.compiled_class_hash_of_class_hash(hash)?.is_some() { - self.tx.get::(hash).map_err(|e| e.into()) + self.tx.get::(hash).map_err(|e| e.into()) } else { Ok(None) } @@ -242,7 +242,7 @@ impl ContractClassProvider for HistoricalStateProvider { impl StateProvider for HistoricalStateProvider { fn nonce(&self, address: ContractAddress) -> ProviderResult> { - let change_list = self.tx.get::(address)?; + let change_list = self.tx.get::(address)?; if let Some(num) = change_list.and_then(|entry| { Self::recent_block_change_relative_to_pinned_block_num( @@ -250,7 +250,7 @@ impl StateProvider for HistoricalStateProvider { &entry.nonce_change_list, ) }) { - let mut cursor = self.tx.cursor::()?; + let mut cursor = self.tx.cursor::()?; let entry = cursor.seek_by_key_subkey(num, address)?.ok_or( ProviderError::MissingContractNonceChangeEntry { block: num, @@ -271,7 +271,7 @@ impl StateProvider for HistoricalStateProvider { address: ContractAddress, ) -> ProviderResult> { let change_list: Option = - self.tx.get::(address)?; + self.tx.get::(address)?; if let Some(num) = change_list.and_then(|entry| { Self::recent_block_change_relative_to_pinned_block_num( @@ -279,7 +279,7 @@ impl StateProvider for HistoricalStateProvider { &entry.class_change_list, ) }) { - let mut cursor = self.tx.cursor::()?; + let mut cursor = self.tx.cursor::()?; let entry = cursor.seek_by_key_subkey(num, address)?.ok_or( ProviderError::MissingContractClassChangeEntry { block: num, @@ -300,7 +300,7 @@ impl StateProvider for HistoricalStateProvider { address: ContractAddress, storage_key: StorageKey, ) -> ProviderResult> { - let mut cursor = self.tx.cursor::()?; + let mut cursor = self.tx.cursor::()?; if let Some(num) = cursor.seek_by_key_subkey(address, storage_key)?.and_then(|entry| { Self::recent_block_change_relative_to_pinned_block_num( @@ -308,7 +308,7 @@ impl StateProvider for HistoricalStateProvider { &entry.block_list, ) }) { - let mut cursor = self.tx.cursor::()?; + let mut cursor = self.tx.cursor::()?; let sharded_key = ContractStorageKey { contract_address: address, key: storage_key }; let entry = cursor.seek_by_key_subkey(num, sharded_key)?.ok_or(