feat: add Block AT to BlockReader (#12837)

This commit is contained in:
Arsenii Kulikov
2024-11-25 18:28:56 +04:00
committed by GitHub
parent e2c42ae242
commit c44e11b8ad
69 changed files with 664 additions and 267 deletions

View File

@ -1,11 +1,12 @@
use crate::{segments::SegmentSet, Pruner};
use alloy_eips::eip2718::Encodable2718;
use reth_chainspec::MAINNET;
use reth_config::PruneConfig;
use reth_db::transaction::DbTxMut;
use reth_exex_types::FinishedExExHeight;
use reth_provider::{
providers::StaticFileProvider, BlockReader, DBProvider, DatabaseProviderFactory,
PruneCheckpointWriter, StaticFileProviderFactory, TransactionsProvider,
PruneCheckpointWriter, StaticFileProviderFactory,
};
use reth_prune_types::PruneModes;
use std::time::Duration;
@ -77,7 +78,9 @@ impl PrunerBuilder {
pub fn build_with_provider_factory<PF>(self, provider_factory: PF) -> Pruner<PF::ProviderRW, PF>
where
PF: DatabaseProviderFactory<
ProviderRW: PruneCheckpointWriter + BlockReader + StaticFileProviderFactory,
ProviderRW: PruneCheckpointWriter
+ BlockReader<Transaction: Encodable2718>
+ StaticFileProviderFactory,
> + StaticFileProviderFactory<
Primitives = <PF::ProviderRW as StaticFileProviderFactory>::Primitives,
>,
@ -103,9 +106,8 @@ impl PrunerBuilder {
where
Provider: StaticFileProviderFactory
+ DBProvider<Tx: DbTxMut>
+ BlockReader
+ PruneCheckpointWriter
+ TransactionsProvider,
+ BlockReader<Transaction: Encodable2718>
+ PruneCheckpointWriter,
{
let segments = SegmentSet::<Provider>::from_components(static_file_provider, self.segments);

View File

@ -2,10 +2,11 @@ use crate::segments::{
AccountHistory, ReceiptsByLogs, Segment, SenderRecovery, StorageHistory, TransactionLookup,
UserReceipts,
};
use alloy_eips::eip2718::Encodable2718;
use reth_db::transaction::DbTxMut;
use reth_provider::{
providers::StaticFileProvider, BlockReader, DBProvider, PruneCheckpointWriter,
StaticFileProviderFactory, TransactionsProvider,
StaticFileProviderFactory,
};
use reth_prune_types::PruneModes;
@ -47,9 +48,8 @@ impl<Provider> SegmentSet<Provider>
where
Provider: StaticFileProviderFactory
+ DBProvider<Tx: DbTxMut>
+ TransactionsProvider
+ PruneCheckpointWriter
+ BlockReader,
+ BlockReader<Transaction: Encodable2718>,
{
/// Creates a [`SegmentSet`] from an existing components, such as [`StaticFileProvider`] and
/// [`PruneModes`].

View File

@ -6,7 +6,7 @@ use crate::{
use alloy_eips::eip2718::Encodable2718;
use rayon::prelude::*;
use reth_db::{tables, transaction::DbTxMut};
use reth_provider::{BlockReader, DBProvider, TransactionsProvider};
use reth_provider::{BlockReader, DBProvider};
use reth_prune_types::{
PruneMode, PruneProgress, PrunePurpose, PruneSegment, SegmentOutputCheckpoint,
};
@ -25,7 +25,7 @@ impl TransactionLookup {
impl<Provider> Segment<Provider> for TransactionLookup
where
Provider: DBProvider<Tx: DbTxMut> + TransactionsProvider + BlockReader,
Provider: DBProvider<Tx: DbTxMut> + BlockReader<Transaction: Encodable2718>,
{
fn segment(&self) -> PruneSegment {
PruneSegment::TransactionLookup