Skip to content

Commit

Permalink
feat(tree): replace db provider with real get_state method
Browse files Browse the repository at this point in the history
  • Loading branch information
Rjected committed Sep 26, 2024
1 parent 59f30ac commit e177f80
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions crates/storage/provider/src/providers/blockchain_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ impl<N: ProviderNodeTypes> BlockchainProvider2<N> {

/// Return the last N blocks of state, recreating the [`ExecutionOutcome`].
///
/// 1. Iterate over the [`BlockBodyIndices`][tables::BlockBodyIndices] table to get all the
/// 1. Iterate over the [`BlockBodyIndices`][reth_db::BlockBodyIndices] table to get all the
/// transaction ids.
/// 2. Iterate over the [`StorageChangeSets`][tables::StorageChangeSets] table and the
/// [`AccountChangeSets`][tables::AccountChangeSets] tables in reverse order to reconstruct
/// 2. Iterate over the [`StorageChangeSets`][reth_db::StorageChangeSets] table and the
/// [`AccountChangeSets`][reth_db::AccountChangeSets] tables in reverse order to reconstruct
/// the changesets.
/// - In order to have both the old and new values in the changesets, we also access the
/// plain state tables.
Expand Down Expand Up @@ -219,8 +219,8 @@ impl<N: ProviderNodeTypes> BlockchainProvider2<N> {
}

/// Populate a [`BundleStateInit`] and [`RevertsInit`] using cursors over the
/// [`PlainAccountState`] and [`PlainStorageState`] tables, based on the given storage and
/// account changesets.
/// [`reth_db::PlainAccountState`] and [`reth_db::PlainStorageState`] tables, based on the given
/// storage and account changesets.
fn populate_bundle_state(
&self,
account_changeset: Vec<(u64, AccountBeforeTx)>,
Expand Down Expand Up @@ -1598,7 +1598,7 @@ impl<N: ProviderNodeTypes> StateReader for BlockchainProvider2<N> {
let state = state.block().execution_outcome().clone();
Ok(Some(state))
} else {
self.database.provider()?.get_state(block..=block)
self.get_state(block..=block)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/storage/provider/src/providers/database/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1418,7 +1418,7 @@ impl<TX: DbTx, Spec: Send + Sync> StorageChangeSetReader for DatabaseProvider<TX
block_number: BlockNumber,
) -> ProviderResult<Vec<(BlockNumberAddress, StorageEntry)>> {
let range = block_number..=block_number;
let storage_range = BlockNumberAddress::range(range.clone());
let storage_range = BlockNumberAddress::range(range);
self.tx
.cursor_dup_read::<tables::StorageChangeSets>()?
.walk_range(storage_range)?
Expand Down

0 comments on commit e177f80

Please sign in to comment.