diff --git a/crates/storage/provider/src/providers/state/historical.rs b/crates/storage/provider/src/providers/state/historical.rs
index 8168f6a2ab..7811d9d7cf 100644
--- a/crates/storage/provider/src/providers/state/historical.rs
+++ b/crates/storage/provider/src/providers/state/historical.rs
@@ -1,4 +1,7 @@
-use crate::{AccountProvider, BlockHashProvider, Error, StateProvider};
+use crate::{
+ providers::state::macros::delegate_provider_impls, AccountProvider, BlockHashProvider, Error,
+ StateProvider,
+};
use reth_db::{
cursor::{DbCursorRO, DbDupCursorRO},
models::{storage_sharded_key::StorageShardedKey, ShardedKey},
@@ -130,32 +133,22 @@ impl<'a, TX: DbTx<'a>> HistoricalStateProvider<'a, TX> {
pub fn new(tx: TX, transition: TransitionId) -> Self {
Self { tx, transition, _phantom: PhantomData {} }
}
+
+ /// Returns a new provider that takes the `TX` as reference
+ #[inline(always)]
+ fn as_ref<'b>(&'b self) -> HistoricalStateProviderRef<'a, 'b, TX> {
+ HistoricalStateProviderRef::new(&self.tx, self.transition)
+ }
}
-/// Derive trait implementation for [HistoricalStateProvider]
-/// from [HistoricalStateProviderRef] type.
-///
-/// Used to implement provider traits.
-macro_rules! derive_from_ref {
- ($trait:ident, $(fn $func:ident(&self$(, )?$($arg_name:ident: $arg:ty),*) -> $ret:ty),*) => {
- impl<'a, TX: DbTx<'a>> $trait for HistoricalStateProvider<'a, TX> {
- $(fn $func(&self, $($arg_name: $arg),*) -> $ret {
- HistoricalStateProviderRef::new(&self.tx, self.transition).$func($($arg_name),*)
- })*
- }
- };
-}
-
-derive_from_ref!(AccountProvider, fn basic_account(&self, address: Address) -> Result