From 362e2ed0af251b4c90246cc78b0d0e8349d6c758 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Fri, 22 Nov 2024 16:35:50 +0100 Subject: [PATCH] chore: rename transaction_by_id_no_hash fn (#12783) --- crates/stages/stages/src/stages/sender_recovery.rs | 2 +- .../storage/provider/src/providers/blockchain_provider.rs | 6 +++--- crates/storage/provider/src/providers/consistent.rs | 4 ++-- crates/storage/provider/src/providers/database/mod.rs | 6 +++--- .../storage/provider/src/providers/database/provider.rs | 8 ++++---- crates/storage/provider/src/providers/mod.rs | 4 ++-- crates/storage/provider/src/providers/static_file/jar.rs | 2 +- .../storage/provider/src/providers/static_file/manager.rs | 6 +++--- crates/storage/provider/src/test_utils/mock.rs | 2 +- crates/storage/provider/src/test_utils/noop.rs | 2 +- crates/storage/storage-api/src/transactions.rs | 2 +- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/crates/stages/stages/src/stages/sender_recovery.rs b/crates/stages/stages/src/stages/sender_recovery.rs index 0b8e2faae..d611062b5 100644 --- a/crates/stages/stages/src/stages/sender_recovery.rs +++ b/crates/stages/stages/src/stages/sender_recovery.rs @@ -667,7 +667,7 @@ mod tests { while let Some((_, body)) = body_cursor.next()? { for tx_id in body.tx_num_range() { let transaction: TransactionSigned = provider - .transaction_by_id_no_hash(tx_id)? + .transaction_by_id_unhashed(tx_id)? .map(|tx| { TransactionSigned::new_unhashed(tx.transaction, tx.signature) }) diff --git a/crates/storage/provider/src/providers/blockchain_provider.rs b/crates/storage/provider/src/providers/blockchain_provider.rs index 74009ffff..744120dd0 100644 --- a/crates/storage/provider/src/providers/blockchain_provider.rs +++ b/crates/storage/provider/src/providers/blockchain_provider.rs @@ -339,11 +339,11 @@ impl TransactionsProvider for BlockchainProvider2 { self.consistent_provider()?.transaction_by_id(id) } - fn transaction_by_id_no_hash( + fn transaction_by_id_unhashed( &self, id: TxNumber, ) -> ProviderResult> { - self.consistent_provider()?.transaction_by_id_no_hash(id) + self.consistent_provider()?.transaction_by_id_unhashed(id) } fn transaction_by_hash(&self, hash: TxHash) -> ProviderResult> { @@ -2588,7 +2588,7 @@ mod tests { ), ( ONE, - transaction_by_id_no_hash, + transaction_by_id_unhashed, |block: &SealedBlock, tx_num: TxNumber, _: B256, _: &Vec>| ( tx_num, Some(Into::::into( diff --git a/crates/storage/provider/src/providers/consistent.rs b/crates/storage/provider/src/providers/consistent.rs index 3b2599f49..7d52dfcc4 100644 --- a/crates/storage/provider/src/providers/consistent.rs +++ b/crates/storage/provider/src/providers/consistent.rs @@ -945,13 +945,13 @@ impl TransactionsProvider for ConsistentProvider { ) } - fn transaction_by_id_no_hash( + fn transaction_by_id_unhashed( &self, id: TxNumber, ) -> ProviderResult> { self.get_in_memory_or_storage_by_tx( id.into(), - |provider| provider.transaction_by_id_no_hash(id), + |provider| provider.transaction_by_id_unhashed(id), |tx_index, _, block_state| { Ok(block_state .block_ref() diff --git a/crates/storage/provider/src/providers/database/mod.rs b/crates/storage/provider/src/providers/database/mod.rs index 7d94fb98a..491c79d7a 100644 --- a/crates/storage/provider/src/providers/database/mod.rs +++ b/crates/storage/provider/src/providers/database/mod.rs @@ -433,15 +433,15 @@ impl TransactionsProvider for ProviderFactory { ) } - fn transaction_by_id_no_hash( + fn transaction_by_id_unhashed( &self, id: TxNumber, ) -> ProviderResult> { self.static_file_provider.get_with_static_file_or_database( StaticFileSegment::Transactions, id, - |static_file| static_file.transaction_by_id_no_hash(id), - || self.provider()?.transaction_by_id_no_hash(id), + |static_file| static_file.transaction_by_id_unhashed(id), + || self.provider()?.transaction_by_id_unhashed(id), ) } diff --git a/crates/storage/provider/src/providers/database/provider.rs b/crates/storage/provider/src/providers/database/provider.rs index bcb9fa415..279637abd 100644 --- a/crates/storage/provider/src/providers/database/provider.rs +++ b/crates/storage/provider/src/providers/database/provider.rs @@ -1482,14 +1482,14 @@ impl> Transaction ) } - fn transaction_by_id_no_hash( + fn transaction_by_id_unhashed( &self, id: TxNumber, ) -> ProviderResult> { self.static_file_provider.get_with_static_file_or_database( StaticFileSegment::Transactions, id, - |static_file| static_file.transaction_by_id_no_hash(id), + |static_file| static_file.transaction_by_id_unhashed(id), || Ok(self.tx.get::(id)?), ) } @@ -1497,7 +1497,7 @@ impl> Transaction fn transaction_by_hash(&self, hash: TxHash) -> ProviderResult> { if let Some(id) = self.transaction_id(hash)? { Ok(self - .transaction_by_id_no_hash(id)? + .transaction_by_id_unhashed(id)? .map(|tx| TransactionSigned::new(tx.transaction, tx.signature, hash))) } else { Ok(None) @@ -1511,7 +1511,7 @@ impl> Transaction ) -> ProviderResult> { let mut transaction_cursor = self.tx.cursor_read::()?; if let Some(transaction_id) = self.transaction_id(tx_hash)? { - if let Some(tx) = self.transaction_by_id_no_hash(transaction_id)? { + if let Some(tx) = self.transaction_by_id_unhashed(transaction_id)? { let transaction = TransactionSigned::new(tx.transaction, tx.signature, tx_hash); if let Some(block_number) = transaction_cursor.seek(transaction_id).map(|b| b.map(|(_, bn)| bn))? diff --git a/crates/storage/provider/src/providers/mod.rs b/crates/storage/provider/src/providers/mod.rs index d53091790..4d641bb29 100644 --- a/crates/storage/provider/src/providers/mod.rs +++ b/crates/storage/provider/src/providers/mod.rs @@ -425,11 +425,11 @@ impl TransactionsProvider for BlockchainProvider { self.database.transaction_by_id(id) } - fn transaction_by_id_no_hash( + fn transaction_by_id_unhashed( &self, id: TxNumber, ) -> ProviderResult> { - self.database.transaction_by_id_no_hash(id) + self.database.transaction_by_id_unhashed(id) } fn transaction_by_hash(&self, hash: TxHash) -> ProviderResult> { diff --git a/crates/storage/provider/src/providers/static_file/jar.rs b/crates/storage/provider/src/providers/static_file/jar.rs index e87829b11..b3ff20d91 100644 --- a/crates/storage/provider/src/providers/static_file/jar.rs +++ b/crates/storage/provider/src/providers/static_file/jar.rs @@ -221,7 +221,7 @@ impl TransactionsProvider for StaticFileJarProvider<'_, N> { .map(|tx| tx.with_hash())) } - fn transaction_by_id_no_hash( + fn transaction_by_id_unhashed( &self, num: TxNumber, ) -> ProviderResult> { diff --git a/crates/storage/provider/src/providers/static_file/manager.rs b/crates/storage/provider/src/providers/static_file/manager.rs index bee42fdac..7bf0c4989 100644 --- a/crates/storage/provider/src/providers/static_file/manager.rs +++ b/crates/storage/provider/src/providers/static_file/manager.rs @@ -1463,12 +1463,12 @@ impl TransactionsProvider for StaticFileProvider { }) } - fn transaction_by_id_no_hash( + fn transaction_by_id_unhashed( &self, num: TxNumber, ) -> ProviderResult> { self.get_segment_provider_from_transaction(StaticFileSegment::Transactions, num, None) - .and_then(|provider| provider.transaction_by_id_no_hash(num)) + .and_then(|provider| provider.transaction_by_id_unhashed(num)) .or_else(|err| { if let ProviderError::MissingStaticFileTx(_, _) = err { Ok(None) @@ -1541,7 +1541,7 @@ impl TransactionsProvider for StaticFileProvider { } fn transaction_sender(&self, id: TxNumber) -> ProviderResult> { - Ok(self.transaction_by_id_no_hash(id)?.and_then(|tx| tx.recover_signer())) + Ok(self.transaction_by_id_unhashed(id)?.and_then(|tx| tx.recover_signer())) } } diff --git a/crates/storage/provider/src/test_utils/mock.rs b/crates/storage/provider/src/test_utils/mock.rs index 43bb1e809..77a4b75a0 100644 --- a/crates/storage/provider/src/test_utils/mock.rs +++ b/crates/storage/provider/src/test_utils/mock.rs @@ -263,7 +263,7 @@ impl TransactionsProvider for MockEthProvider { Ok(transaction) } - fn transaction_by_id_no_hash( + fn transaction_by_id_unhashed( &self, id: TxNumber, ) -> ProviderResult> { diff --git a/crates/storage/provider/src/test_utils/noop.rs b/crates/storage/provider/src/test_utils/noop.rs index d12539a2c..966bab594 100644 --- a/crates/storage/provider/src/test_utils/noop.rs +++ b/crates/storage/provider/src/test_utils/noop.rs @@ -200,7 +200,7 @@ impl TransactionsProvider for NoopProvider { Ok(None) } - fn transaction_by_id_no_hash( + fn transaction_by_id_unhashed( &self, _id: TxNumber, ) -> ProviderResult> { diff --git a/crates/storage/storage-api/src/transactions.rs b/crates/storage/storage-api/src/transactions.rs index f2c44e9e1..a639fcedd 100644 --- a/crates/storage/storage-api/src/transactions.rs +++ b/crates/storage/storage-api/src/transactions.rs @@ -31,7 +31,7 @@ pub trait TransactionsProvider: BlockNumReader + Send + Sync { fn transaction_by_id(&self, id: TxNumber) -> ProviderResult>; /// Get transaction by id without computing the hash. - fn transaction_by_id_no_hash( + fn transaction_by_id_unhashed( &self, id: TxNumber, ) -> ProviderResult>;