From 5c30227d339bbf1a538b7716ce7f8111c84899ec Mon Sep 17 00:00:00 2001 From: Dan Cline <6798349+Rjected@users.noreply.github.com> Date: Mon, 22 Jul 2024 13:41:37 -0400 Subject: [PATCH] docs: add pruning related documentation for db service (#9711) --- crates/engine/tree/src/database.rs | 5 ++++- .../src/providers/database/provider.rs | 21 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/crates/engine/tree/src/database.rs b/crates/engine/tree/src/database.rs index d7607afa2e..b7481fb0a9 100644 --- a/crates/engine/tree/src/database.rs +++ b/crates/engine/tree/src/database.rs @@ -39,7 +39,10 @@ pub struct DatabaseService { } impl DatabaseService { - /// Create a new database service + /// Create a new database service. + /// + /// NOTE: The [`ProviderFactory`] and [`Pruner`] should be built using an identical + /// [`PruneModes`](reth_prune::PruneModes). pub const fn new( provider: ProviderFactory, incoming: Receiver, diff --git a/crates/storage/provider/src/providers/database/provider.rs b/crates/storage/provider/src/providers/database/provider.rs index 422f145d77..030e1c93f0 100644 --- a/crates/storage/provider/src/providers/database/provider.rs +++ b/crates/storage/provider/src/providers/database/provider.rs @@ -3142,6 +3142,27 @@ impl BlockExecutionWriter for DatabaseProviderRW { } impl BlockWriter for DatabaseProviderRW { + /// Inserts the block into the database, always modifying the following tables: + /// * [`CanonicalHeaders`](tables::CanonicalHeaders) + /// * [`Headers`](tables::Headers) + /// * [`HeaderNumbers`](tables::HeaderNumbers) + /// * [`HeaderTerminalDifficulties`](tables::HeaderTerminalDifficulties) + /// * [`BlockBodyIndices`](tables::BlockBodyIndices) + /// + /// If there are transactions in the block, the following tables will be modified: + /// * [`Transactions`](tables::Transactions) + /// * [`TransactionBlocks`](tables::TransactionBlocks) + /// + /// If ommers are not empty, this will modify [`BlockOmmers`](tables::BlockOmmers). + /// If withdrawals are not empty, this will modify + /// [`BlockWithdrawals`](tables::BlockWithdrawals). + /// If requests are not empty, this will modify [`BlockRequests`](tables::BlockRequests). + /// + /// If the provider has __not__ configured full sender pruning, this will modify + /// [`TransactionSenders`](tables::TransactionSenders). + /// + /// If the provider has __not__ configured full transaction lookup pruning, this will modify + /// [`TransactionHashNumbers`](tables::TransactionHashNumbers). fn insert_block( &self, block: SealedBlockWithSenders,