Skip to content

Commit 326a401

Browse files
authored
docs: add migration docs (#2580)
<!-- Please read and fill out this form before submitting your PR. Please make sure you have reviewed our contributors guide before submitting your first PR. NOTE: PR titles should follow semantic commits: https://www.conventionalcommits.org/en/v1.0.0/ --> ## Overview <!-- Please provide an explanation of the PR, including the appropriate context, background, goal, and rationale. If there is an issue with this information, please provide a tl;dr and link the issue. Ex: Closes #<issue number> -->
1 parent 293f036 commit 326a401

File tree

1 file changed

+62
-19
lines changed

1 file changed

+62
-19
lines changed

docs/guides/evm/migration.md

Lines changed: 62 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,24 @@ All network participants must agree on:
5252

5353
### 3. Stop the Node at Target Height
5454

55-
Configure your node to stop at the agreed-upon migration height:
55+
Configure your node to stop at the agreed-upon migration height. Both the Evolve node and ev-reth must be stopped to properly export the genesis state:
5656

5757
```bash
5858
# Stop the Evolve node gracefully
59-
docker stop evolve-node
59+
docker stop ev-node
6060

6161
# Or if running as a service
62-
systemctl stop evolve-node
62+
systemctl stop ev-node
63+
64+
# Stop ev-reth
65+
docker stop ev-reth
66+
67+
# Or if running as a service
68+
systemctl stop ev-reth
6369
```
6470

71+
**Important**: ev-reth must be completely shutdown before running `dump-genesis` as the export process requires exclusive access to the database.
72+
6573
### 4. Export Current State Using reth dump-genesis
6674

6775
reth dump-genesis exports the current head state in the node’s local database into a genesis file.
@@ -70,49 +78,57 @@ It does not accept a --block flag, so to capture a specific migration height you
7078
7179

7280
Option 1 — Stop at the target height before dumping
81+
7382
- Sync your Evolve/reth node to the agreed migration height.
7483
- Disable block production or stop the sequencer so no new blocks are added.
7584
- Run dump-genesis while the DB is exactly at the migration height.
7685

86+
```bash
7787
# Stop node at migration height
88+
7889
systemctl stop evolve-node
7990

8091
# Export state at current head (must be migration height)
81-
reth dump-genesis \
92+
93+
ev-reth dump-genesis \
8294
--datadir /path/to/reth/datadir \
8395
--output genesis-export.json
84-
96+
```
8597

8698
8799

88100
Option 2 — Rewind DB to migration height
89101

90102
If your node has already synced past the migration block:
91103

104+
```bash
92105
reth db revert-to-block <MIGRATION_BLOCK_HEIGHT> --datadir /path/to/reth/datadir
93106

94107
# Then dump the state
95108
reth dump-genesis \
96109
--datadir /path/to/reth/datadir \
97110
--output genesis-export.json
98-
111+
```
99112

100113
101114

102115
Verification after export:
103116

117+
```bash
104118
# Number of accounts in alloc
119+
105120
jq '.alloc | length' genesis-export.json
106121

107122
# Review chain configuration
108123
jq '.config' genesis-export.json
124+
```
109125

110126
The exported genesis will contain:
127+
111128
- All account balances and nonces
112129
- Contract bytecode and storage
113130
- Current chain configuration
114131

115-
116132
### 5. Prepare New Genesis Configuration
117133

118134
Once you have genesis-export.json, update it for the new chain parameters.
@@ -143,7 +159,6 @@ jq '.config.chainId = <NEW_CHAIN_ID> |
143159
genesis-export.json > genesis-new.json
144160
```
145161

146-
147162
### 6. Initialize New Chain with reth init
148163

149164
Initialize the new chain using the modified genesis:
@@ -161,29 +176,44 @@ reth init \
161176
reth db stats --datadir /path/to/new/reth/datadir
162177
```
163178

164-
### 7. Update Node Configuration
179+
### 7. Update Node Configuration and Purge Data
180+
181+
Update your Evolve node configuration for the new chain and purge the data directory:
165182

166-
Update your Evolve node configuration for the new chain:
183+
**CRITICAL**: Always preserve the `$HOME_DIR/config` directory as it contains essential sequencer node ID and private keys.
167184

168-
```yaml
169-
# evolve.yml
170-
chain_id: <NEW_CHAIN_ID>
171-
genesis_file: /path/to/genesis-new.json
172-
reth:
173-
datadir: /path/to/new/reth/datadir
174-
network_id: <NEW_NETWORK_ID>
185+
```bash
186+
# Update the configuration file with new chain ID
187+
# Edit $HOME_DIR/config/evolve.yaml
188+
sed -i 's/chain_id: .*/chain_id: <NEW_CHAIN_ID>/' $HOME_DIR/config/evolve.yaml
189+
190+
# Purge the data directory
191+
rm -rf $HOME_DIR/data
175192
```
176193

194+
**Important Notes**:
195+
196+
- The `$HOME_DIR/config` directory contains critical sequencer node identity and private keys
197+
- **Never delete the config directory** - this would result in loss of node identity
198+
- Only the `data` directory should be purged to start fresh with the new chain
199+
- Backup your config directory before migration as an additional safety measure
200+
177201
### 8. Start the New Chain
178202

179203
Start your node with the new configuration:
180204

181205
```bash
182206
# Start Evolve node with new configuration
183-
evolve start --config evolve.yml
207+
docker start ev-reth
208+
209+
# Or if running as a service
210+
systemctl start ev-reth
184211

185212
# Monitor logs for successful startup
186-
tail -f /var/log/evolve/node.log
213+
docker logs ev-reth
214+
215+
# Or if running as a service
216+
journalctl -xeu ev-reth
187217
```
188218

189219
## External Services Coordination
@@ -198,6 +228,7 @@ Bridge operators must be notified well in advance to:
198228
- **Map balances**: Ensure locked tokens match bridged tokens on new chain
199229

200230
Coordination checklist:
231+
201232
```markdown
202233
- [ ] Notify bridge operators 2 weeks before migration
203234
- [ ] Pause bridge operations at block height - 100
@@ -217,6 +248,7 @@ Explorer operators need to:
217248
- **Redirect users**: Implement proper redirects and notifications
218249

219250
Explorer coordination:
251+
220252
```bash
221253
# Provide explorer operators with:
222254
- New genesis file
@@ -238,6 +270,7 @@ Exchange integration requires careful coordination:
238270
- **Resume operations**: Gradual reopening after validation
239271

240272
Exchange checklist:
273+
241274
```markdown
242275
- [ ] 30-day advance notice to exchanges
243276
- [ ] Provide technical migration guide
@@ -354,26 +387,31 @@ Here's a recommended timeline for chain migration:
354387

355388
```markdown
356389
### T-30 days
390+
357391
- [ ] Initial migration announcement
358392
- [ ] Technical documentation published
359393
- [ ] Begin coordination with service providers
360394

361395
### T-14 days
396+
362397
- [ ] Finalize migration block height
363398
- [ ] Confirm participation from all validators
364399
- [ ] Service providers confirm readiness
365400

366401
### T-7 days
402+
367403
- [ ] Final migration parameters locked
368404
- [ ] Test migration on testnet
369405
- [ ] Public reminder announcements
370406

371407
### T-24 hours
408+
372409
- [ ] Final coordination call
373410
- [ ] Service suspension notifications
374411
- [ ] Last-chance backups
375412

376413
### T-0 (Migration)
414+
377415
- [ ] Stop nodes at target height
378416
- [ ] Export state
379417
- [ ] Generate new genesis
@@ -382,11 +420,13 @@ Here's a recommended timeline for chain migration:
382420
- [ ] Initial validation
383421

384422
### T+6 hours
423+
385424
- [ ] Service providers begin reconnection
386425
- [ ] Initial functionality tests
387426
- [ ] Public progress updates
388427

389428
### T+24 hours
429+
390430
- [ ] Full service restoration
391431
- [ ] Post-migration report
392432
- [ ] Address any issues
@@ -397,13 +437,15 @@ Here's a recommended timeline for chain migration:
397437
### Common Issues and Solutions
398438

399439
**State Export Failures**:
440+
400441
```bash
401442
# If export fails due to memory, increase heap size
402443
export RETH_HEAP_SIZE=8g
403444
reth dump-genesis --datadir /path/to/datadir
404445
```
405446

406447
**Genesis Initialization Errors**:
448+
407449
```bash
408450
# Verify genesis file format
409451
jq empty genesis-new.json # Should return nothing if valid
@@ -413,6 +455,7 @@ jq '.config.chainId, .alloc, .timestamp' genesis-new.json
413455
```
414456

415457
**Node Sync Issues**:
458+
416459
```bash
417460
# Clear peer database and reconnect
418461
rm -rf /path/to/datadir/nodes

0 commit comments

Comments
 (0)