Skip to content

Commit

Permalink
refactor: use DBProvider in HistoricalStateProvider (#12556)
Browse files Browse the repository at this point in the history
  • Loading branch information
klkvr authored Nov 14, 2024
1 parent 28a5b63 commit a534db8
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 162 deletions.
9 changes: 2 additions & 7 deletions crates/storage/provider/src/providers/database/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,7 @@ impl<TX: DbTx + 'static, N: NodeTypes> DatabaseProvider<TX, N> {
let storage_history_prune_checkpoint =
self.get_prune_checkpoint(PruneSegment::StorageHistory)?;

let mut state_provider = HistoricalStateProviderRef::new(
&self.tx,
block_number,
self.static_file_provider.clone(),
);
let mut state_provider = HistoricalStateProviderRef::new(self, block_number);

// If we pruned account or storage history, we can't return state on every historical block.
// Instead, we should cap it at the latest prune checkpoint for corresponding prune segment.
Expand Down Expand Up @@ -259,8 +255,7 @@ impl<TX: DbTx + 'static, N: NodeTypes> TryIntoHistoricalStateProvider for Databa
let storage_history_prune_checkpoint =
self.get_prune_checkpoint(PruneSegment::StorageHistory)?;

let mut state_provider =
HistoricalStateProvider::new(self.tx, block_number, self.static_file_provider);
let mut state_provider = HistoricalStateProvider::new(self, block_number);

// If we pruned account or storage history, we can't return state on every historical block.
// Instead, we should cap it at the latest prune checkpoint for corresponding prune segment.
Expand Down
Loading

0 comments on commit a534db8

Please sign in to comment.