mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix(storage): dont skip consistency checks for op-mainnet if using minimal bootstrap (#11099)
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -8308,6 +8308,7 @@ dependencies = [
|
|||||||
"reth-network-p2p",
|
"reth-network-p2p",
|
||||||
"reth-nippy-jar",
|
"reth-nippy-jar",
|
||||||
"reth-node-types",
|
"reth-node-types",
|
||||||
|
"reth-optimism-primitives",
|
||||||
"reth-primitives",
|
"reth-primitives",
|
||||||
"reth-prune-types",
|
"reth-prune-types",
|
||||||
"reth-stages-types",
|
"reth-stages-types",
|
||||||
|
|||||||
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
To sync OP mainnet, bedrock state needs to be imported as a starting point. There are currently two ways:
|
To sync OP mainnet, bedrock state needs to be imported as a starting point. There are currently two ways:
|
||||||
|
|
||||||
* Minimal bootstrap: only state snapshot at Bedrock block is imported without any OVM historical data.
|
* Minimal bootstrap **(recommended)**: only state snapshot at Bedrock block is imported without any OVM historical data.
|
||||||
* Full bootstrap: state, blocks and receipts are imported.
|
* Full bootstrap **(not recommended)**: state, blocks and receipts are imported. *Not recommended for now: [storage consistency issue](https://github.com/paradigmxyz/reth/pull/11099) tldr: sudden crash may break the node
|
||||||
|
|
||||||
## Minimal bootstrap
|
## Minimal bootstrap (recommended)
|
||||||
|
|
||||||
**The state snapshot at Bedrock block is required.** It can be exported from [op-geth](https://github.com/testinprod-io/op-erigon/blob/pcw109550/bedrock-db-migration/bedrock-migration.md#export-state) (**.jsonl**) or downloaded directly from [here](https://mega.nz/file/GdZ1xbAT#a9cBv3AqzsTGXYgX7nZc_3fl--tcBmOAIwIA5ND6kwc).
|
**The state snapshot at Bedrock block is required.** It can be exported from [op-geth](https://github.com/testinprod-io/op-erigon/blob/pcw109550/bedrock-db-migration/bedrock-migration.md#export-state) (**.jsonl**) or downloaded directly from [here](https://mega.nz/file/GdZ1xbAT#a9cBv3AqzsTGXYgX7nZc_3fl--tcBmOAIwIA5ND6kwc).
|
||||||
|
|
||||||
@ -16,7 +16,9 @@ $ op-reth node --chain optimism --datadir op-mainnet --debug.tip 0x098f87b75c8b8
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Full bootstrap
|
## Full bootstrap (not recommended)
|
||||||
|
|
||||||
|
**Not recommended for now**: [storage consistency issue](https://github.com/paradigmxyz/reth/pull/11099) tldr: sudden crash may break the node.
|
||||||
|
|
||||||
### Import state
|
### Import state
|
||||||
|
|
||||||
|
|||||||
@ -55,6 +55,10 @@ pub fn is_dup_tx(block_number: u64) -> bool {
|
|||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// OVM Header #1 hash.
|
||||||
|
pub const OVM_HEADER_1_HASH: B256 =
|
||||||
|
b256!("bee7192e575af30420cae0c7776304ac196077ee72b048970549e4f08e875453");
|
||||||
|
|
||||||
/// Bedrock hash on Optimism Mainnet.
|
/// Bedrock hash on Optimism Mainnet.
|
||||||
pub const BEDROCK_HEADER_HASH: B256 =
|
pub const BEDROCK_HEADER_HASH: B256 =
|
||||||
b256!("dbf6a80fef073de06add9b0d14026d6e5a86c85f6d102c36d3d8e9cf89c2afd3");
|
b256!("dbf6a80fef073de06add9b0d14026d6e5a86c85f6d102c36d3d8e9cf89c2afd3");
|
||||||
|
|||||||
@ -40,6 +40,9 @@ alloy-primitives.workspace = true
|
|||||||
alloy-rpc-types-engine.workspace = true
|
alloy-rpc-types-engine.workspace = true
|
||||||
revm.workspace = true
|
revm.workspace = true
|
||||||
|
|
||||||
|
# optimism
|
||||||
|
reth-optimism-primitives = { workspace = true, optional = true }
|
||||||
|
|
||||||
# async
|
# async
|
||||||
tokio = { workspace = true, features = ["sync", "macros", "rt-multi-thread"] }
|
tokio = { workspace = true, features = ["sync", "macros", "rt-multi-thread"] }
|
||||||
|
|
||||||
@ -79,7 +82,7 @@ once_cell.workspace = true
|
|||||||
eyre.workspace = true
|
eyre.workspace = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
optimism = ["reth-primitives/optimism", "reth-execution-types/optimism"]
|
optimism = ["reth-primitives/optimism", "reth-execution-types/optimism", "reth-optimism-primitives"]
|
||||||
serde = ["reth-execution-types/serde"]
|
serde = ["reth-execution-types/serde"]
|
||||||
test-utils = [
|
test-utils = [
|
||||||
"reth-db/test-utils",
|
"reth-db/test-utils",
|
||||||
|
|||||||
@ -12,7 +12,7 @@ use alloy_primitives::{keccak256, Address, BlockHash, BlockNumber, TxHash, TxNum
|
|||||||
use dashmap::DashMap;
|
use dashmap::DashMap;
|
||||||
use notify::{RecommendedWatcher, RecursiveMode, Watcher};
|
use notify::{RecommendedWatcher, RecursiveMode, Watcher};
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
use reth_chainspec::{Chain, ChainInfo, ChainSpecProvider, EthChainSpec};
|
use reth_chainspec::{ChainInfo, ChainSpecProvider};
|
||||||
use reth_db::{
|
use reth_db::{
|
||||||
lockfile::StorageLock,
|
lockfile::StorageLock,
|
||||||
static_file::{iter_static_files, HeaderMask, ReceiptMask, StaticFileCursor, TransactionMask},
|
static_file::{iter_static_files, HeaderMask, ReceiptMask, StaticFileCursor, TransactionMask},
|
||||||
@ -632,14 +632,23 @@ impl StaticFileProvider {
|
|||||||
where
|
where
|
||||||
Provider: DBProvider + BlockReader + StageCheckpointReader + ChainSpecProvider,
|
Provider: DBProvider + BlockReader + StageCheckpointReader + ChainSpecProvider,
|
||||||
{
|
{
|
||||||
// OVM chain contains duplicate transactions, so is inconsistent by default since reth db
|
// OVM historical import is broken and does not work with this check. It's importing
|
||||||
// not designed for duplicate transactions (see <https://github.com/paradigmxyz/reth/blob/v1.0.3/crates/optimism/primitives/src/bedrock_import.rs>). Undefined behaviour for queries
|
// duplicated receipts resulting in having more receipts than the expected transaction
|
||||||
// to OVM chain is also in op-erigon.
|
// range.
|
||||||
if provider.chain_spec().chain() == Chain::optimism_mainnet() {
|
//
|
||||||
|
// If we detect an OVM import was done (block #1 <https://optimistic.etherscan.io/block/1>), skip it.
|
||||||
|
// More on [#11099](https://github.com/paradigmxyz/reth/pull/11099).
|
||||||
|
#[cfg(feature = "optimism")]
|
||||||
|
if reth_chainspec::EthChainSpec::chain(&provider.chain_spec()) ==
|
||||||
|
reth_chainspec::Chain::optimism_mainnet() &&
|
||||||
|
provider
|
||||||
|
.block_number(reth_optimism_primitives::bedrock::OVM_HEADER_1_HASH)?
|
||||||
|
.is_some()
|
||||||
|
{
|
||||||
info!(target: "reth::cli",
|
info!(target: "reth::cli",
|
||||||
"Skipping storage verification for OP mainnet, expected inconsistency in OVM chain"
|
"Skipping storage verification for OP mainnet, expected inconsistency in OVM chain"
|
||||||
);
|
);
|
||||||
return Ok(None);
|
return Ok(None)
|
||||||
}
|
}
|
||||||
|
|
||||||
info!(target: "reth::cli", "Verifying storage consistency.");
|
info!(target: "reth::cli", "Verifying storage consistency.");
|
||||||
|
|||||||
Reference in New Issue
Block a user