mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-30 03:01:58 -04:00
feat(pruning): prune Receipts during pipeline (#3585)
This commit is contained in:
@@ -159,10 +159,11 @@ impl ImportCommand {
|
||||
let (tip_tx, tip_rx) = watch::channel(H256::zero());
|
||||
let factory = reth_revm::Factory::new(self.chain.clone());
|
||||
|
||||
let max_block = file_client.max_block().unwrap_or(0);
|
||||
let mut pipeline = Pipeline::builder()
|
||||
.with_tip_sender(tip_tx)
|
||||
// we want to sync all blocks the file client provides or 0 if empty
|
||||
.with_max_block(file_client.max_block().unwrap_or(0))
|
||||
.with_max_block(max_block)
|
||||
.add_stages(
|
||||
DefaultStages::new(
|
||||
HeaderSyncMode::Tip(tip_rx),
|
||||
@@ -184,6 +185,7 @@ impl ImportCommand {
|
||||
max_blocks: config.stages.execution.max_blocks,
|
||||
max_changes: config.stages.execution.max_changes,
|
||||
},
|
||||
config.prune.map(|prune| prune.parts).unwrap_or_default(),
|
||||
)),
|
||||
)
|
||||
.build(db, self.chain.clone());
|
||||
|
||||
@@ -142,6 +142,7 @@ impl Command {
|
||||
.set(ExecutionStage::new(
|
||||
factory,
|
||||
ExecutionStageThresholds { max_blocks: None, max_changes: None },
|
||||
config.prune.map(|prune| prune.parts).unwrap_or_default(),
|
||||
)),
|
||||
)
|
||||
.build(db, self.chain.clone());
|
||||
|
||||
@@ -8,7 +8,7 @@ use reth_db::{cursor::DbCursorRO, init_db, tables, transaction::DbTx};
|
||||
use reth_primitives::{
|
||||
fs,
|
||||
stage::{StageCheckpoint, StageId},
|
||||
ChainSpec,
|
||||
ChainSpec, PruneTargets,
|
||||
};
|
||||
use reth_provider::{ProviderFactory, StageCheckpointReader};
|
||||
use reth_stages::{
|
||||
@@ -96,6 +96,7 @@ impl Command {
|
||||
let mut execution_stage = ExecutionStage::new(
|
||||
factory,
|
||||
ExecutionStageThresholds { max_blocks: Some(1), max_changes: None },
|
||||
PruneTargets::all(),
|
||||
);
|
||||
|
||||
let mut account_hashing_stage = AccountHashingStage::default();
|
||||
|
||||
@@ -109,7 +109,7 @@ pub fn insert_genesis_state<DB: Database>(
|
||||
state.change_storage(0, *address, storage_changes);
|
||||
}
|
||||
}
|
||||
state.write_to_db(tx)?;
|
||||
state.write_to_db(tx, 0)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -719,6 +719,7 @@ impl Command {
|
||||
max_blocks: stage_config.execution.max_blocks,
|
||||
max_changes: stage_config.execution.max_changes,
|
||||
},
|
||||
config.prune.map(|prune| prune.parts).unwrap_or_default(),
|
||||
)
|
||||
.with_metrics_tx(metrics_tx),
|
||||
)
|
||||
|
||||
@@ -2,7 +2,7 @@ use super::setup;
|
||||
use crate::utils::DbTool;
|
||||
use eyre::Result;
|
||||
use reth_db::{database::Database, table::TableImporter, tables, DatabaseEnv};
|
||||
use reth_primitives::{stage::StageCheckpoint, BlockNumber, ChainSpec};
|
||||
use reth_primitives::{stage::StageCheckpoint, BlockNumber, ChainSpec, PruneTargets};
|
||||
use reth_provider::ProviderFactory;
|
||||
use reth_stages::{
|
||||
stages::{
|
||||
@@ -70,6 +70,7 @@ async fn unwind_and_copy<DB: Database>(
|
||||
let mut exec_stage = ExecutionStage::new(
|
||||
reth_revm::Factory::new(db_tool.chain.clone()),
|
||||
ExecutionStageThresholds { max_blocks: Some(u64::MAX), max_changes: None },
|
||||
PruneTargets::all(),
|
||||
);
|
||||
|
||||
exec_stage
|
||||
|
||||
@@ -202,6 +202,7 @@ impl Command {
|
||||
max_blocks: Some(batch_size),
|
||||
max_changes: None,
|
||||
},
|
||||
config.prune.map(|prune| prune.parts).unwrap_or_default(),
|
||||
)),
|
||||
None,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user