mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: allow syncing op-mainnet with only state and without importing blocks/receipts (#10850)
Co-authored-by: Alexey Shekhirin <a.shekhirin@gmail.com>
This commit is contained in:
@ -1,5 +1,25 @@
|
||||
# Sync OP Mainnet
|
||||
|
||||
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.
|
||||
* Full bootstrap: state, blocks and receipts are imported.
|
||||
|
||||
## Minimal bootstrap
|
||||
|
||||
**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).
|
||||
|
||||
```sh
|
||||
$ op-reth init-state --without-ovm --chain optimism --datadir op-mainnet world_trie_state.jsonl
|
||||
|
||||
$ op-reth node --chain optimism --datadir op-mainnet --debug.tip 0x098f87b75c8b861c775984f9d5dbe7b70cbbbc30fc15adb03a5044de0144f2d0 # block #125200000
|
||||
```
|
||||
|
||||
|
||||
## Full bootstrap
|
||||
|
||||
### Import state
|
||||
|
||||
To sync OP mainnet, the Bedrock datadir needs to be imported to use as starting point.
|
||||
Blocks lower than the OP mainnet Bedrock fork, are built on the OVM and cannot be executed on the EVM.
|
||||
For this reason, the chain segment from genesis until Bedrock, must be manually imported to circumvent
|
||||
@ -10,7 +30,7 @@ Importing OP mainnet Bedrock datadir requires exported data:
|
||||
- Blocks [and receipts] below Bedrock
|
||||
- State snapshot at first Bedrock block
|
||||
|
||||
## Manual Export Steps
|
||||
### Manual Export Steps
|
||||
|
||||
The `op-geth` Bedrock datadir can be downloaded from <https://datadirs.optimism.io/mainnet-bedrock.tar.zst>.
|
||||
|
||||
@ -18,9 +38,9 @@ To export the OVM chain from `op-geth`, clone the `testinprod-io/op-geth` repo a
|
||||
<https://github.com/testinprod-io/op-geth/pull/1>. Commands to export blocks, receipts and state dump can be
|
||||
found in `op-geth/migrate.sh`.
|
||||
|
||||
## Manual Import Steps
|
||||
### Manual Import Steps
|
||||
|
||||
### 1. Import Blocks
|
||||
#### 1. Import Blocks
|
||||
|
||||
Imports a `.rlp` file of blocks.
|
||||
|
||||
@ -30,7 +50,7 @@ Import of >100 million OVM blocks, from genesis to Bedrock, completes in 45 minu
|
||||
$ op-reth import-op <exported-blocks>
|
||||
```
|
||||
|
||||
### 2. Import Receipts
|
||||
#### 2. Import Receipts
|
||||
|
||||
This step is optional. To run a full node, skip this step. If however receipts are to be imported, the
|
||||
corresponding transactions must already be imported (see [step 1](#1-import-blocks)).
|
||||
@ -44,7 +64,7 @@ Import of >100 million OVM receipts, from genesis to Bedrock, completes in 30 mi
|
||||
$ op-reth import-receipts-op <exported-receipts>
|
||||
```
|
||||
|
||||
### 3. Import State
|
||||
#### 3. Import State
|
||||
|
||||
Imports a `.jsonl` state dump. The block at which the state dump is made, must be the latest block in
|
||||
reth's database. This should be block 105 235 063, the first Bedrock block (see [step 1](#1-import-blocks)).
|
||||
@ -61,4 +81,4 @@ Running the node with `--debug.tip <block-hash>`syncs the node without help from
|
||||
block hash can be taken from the latest block on <https://optimistic.etherscan.io>.
|
||||
|
||||
Use `op-node` to track the tip. Start `op-node` with `--syncmode=execution-layer` and `--l2.enginekind=reth`. If `op-node`'s RPC
|
||||
connection to L1 is over localhost, `--l1.trustrpc` can be set to improve performance.
|
||||
connection to L1 is over localhost, `--l1.trustrpc` can be set to improve performance.
|
||||
|
||||
Reference in New Issue
Block a user