feat: always write receipts to static files on new nodes (#19399)

This commit is contained in:
joshieDo
2025-11-13 16:37:30 +00:00
committed by GitHub
parent ca33e8a457
commit 88d853e724
32 changed files with 630 additions and 89 deletions

View File

@@ -42,7 +42,7 @@ use reth_chainspec::{Chain, EthChainSpec, EthereumHardforks};
use reth_config::{config::EtlConfig, PruneConfig};
use reth_consensus::noop::NoopConsensus;
use reth_db_api::{database::Database, database_metrics::DatabaseMetrics};
use reth_db_common::init::{init_genesis, InitStorageError};
use reth_db_common::init::{init_genesis_with_settings, InitStorageError};
use reth_downloaders::{bodies::noop::NoopBodiesDownloader, headers::noop::NoopHeaderDownloader};
use reth_engine_local::MiningMode;
use reth_evm::{noop::NoopEvmConfig, ConfigureEvm};
@@ -482,13 +482,10 @@ where
ProviderFactory::new(self.right().clone(), self.chain_spec(), static_file_provider)?
.with_prune_modes(self.prune_modes());
let has_receipt_pruning = self.toml_config().prune.has_receipts_pruning();
// Check for consistency between database and static files. If it fails, it unwinds to
// the first block that's consistent between database and static files.
if let Some(unwind_target) = factory
.static_file_provider()
.check_consistency(&factory.provider()?, has_receipt_pruning)?
if let Some(unwind_target) =
factory.static_file_provider().check_consistency(&factory.provider()?)?
{
// Highly unlikely to happen, and given its destructive nature, it's better to panic
// instead.
@@ -627,13 +624,19 @@ where
/// Convenience function to [`Self::init_genesis`]
pub fn with_genesis(self) -> Result<Self, InitStorageError> {
init_genesis(self.provider_factory())?;
init_genesis_with_settings(
self.provider_factory(),
self.node_config().static_files.to_settings(),
)?;
Ok(self)
}
/// Write the genesis block and state if it has not already been written
pub fn init_genesis(&self) -> Result<B256, InitStorageError> {
init_genesis(self.provider_factory())
init_genesis_with_settings(
self.provider_factory(),
self.node_config().static_files.to_settings(),
)
}
/// Creates a new `WithMeteredProvider` container and attaches it to the