mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
feat: display warning for op-mainnet launch without pre-Bedrock state (#11765)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -40,9 +40,9 @@ use reth_node_metrics::{
|
||||
use reth_primitives::Head;
|
||||
use reth_provider::{
|
||||
providers::{BlockchainProvider, BlockchainProvider2, ProviderNodeTypes, StaticFileProvider},
|
||||
BlockHashReader, CanonStateNotificationSender, ChainSpecProvider, ProviderFactory,
|
||||
ProviderResult, StageCheckpointReader, StateProviderFactory, StaticFileProviderFactory,
|
||||
TreeViewer,
|
||||
BlockHashReader, BlockNumReader, CanonStateNotificationSender, ChainSpecProvider,
|
||||
ProviderError, ProviderFactory, ProviderResult, StageCheckpointReader, StateProviderFactory,
|
||||
StaticFileProviderFactory, TreeViewer,
|
||||
};
|
||||
use reth_prune::{PruneModes, PrunerBuilder};
|
||||
use reth_rpc_api::clients::EthApiClient;
|
||||
@ -814,6 +814,23 @@ where
|
||||
self.node_config().debug.terminate || self.node_config().debug.max_block.is_some()
|
||||
}
|
||||
|
||||
/// Ensures that the database matches chain-specific requirements.
|
||||
///
|
||||
/// This checks for OP-Mainnet and ensures we have all the necessary data to progress (past
|
||||
/// bedrock height)
|
||||
fn ensure_chain_specific_db_checks(&self) -> ProviderResult<()> {
|
||||
if self.chain_id() == Chain::optimism_mainnet() {
|
||||
let latest = self.blockchain_db().last_block_number()?;
|
||||
// bedrock height
|
||||
if latest < 105235063 {
|
||||
error!("Op-mainnet has been launched without importing the pre-Bedrock state. The chain can't progress without this. See also https://reth.rs/run/sync-op-mainnet.html?minimal-bootstrap-recommended");
|
||||
return Err(ProviderError::BestBlockNotFound)
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Check if the pipeline is consistent (all stages have the checkpoint block numbers no less
|
||||
/// than the checkpoint of the first stage).
|
||||
///
|
||||
@ -857,6 +874,8 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
self.ensure_chain_specific_db_checks()?;
|
||||
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user