File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1374,6 +1374,34 @@ repair-reth() {
13741374}
13751375
13761376
1377+ migrate-reth () {
1378+ local yn
1379+
1380+ # Check for Reth
1381+ __value=" ${COMPOSE_FILE} "
1382+ if [[ ! " ${__value} " =~ reth\. yml ]]; then
1383+ echo " You do not appear to be using Reth. Aborting"
1384+ return 0
1385+ fi
1386+
1387+ if [[ " ${__non_interactive} " -eq 0 ]]; then
1388+ echo
1389+ while true ; do
1390+ read -rp " WARNING - About to migrate the Reth database to v2. This can take up to 24 hours for an archive node. Do you wish to continue? (Y/n) " yn
1391+ case " ${yn} " in
1392+ [Nn]o|[Nn]) echo " Skipping Reth database migration" ; return 0;;
1393+ * ) break ;;
1394+ esac
1395+ done
1396+ fi
1397+
1398+ __docompose exec execution touch /var/lib/reth/migrate-v2
1399+ echo " Restarting Reth to initiate migration"
1400+ echo " You can monitor progress with \" ./ethd logs -f execution\" ."
1401+ restart execution
1402+ }
1403+
1404+
13771405__detect_v6 () {
13781406 local v6_works
13791407
@@ -5980,6 +6008,8 @@ __full_help() {
59806008 echo " stops the Lighthouse consensus client and prunes state."
59816009 echo " repair-reth"
59826010 echo " stops the Reth execution client and repairs its database."
6011+ echo " migrate-reth"
6012+ echo " stops the Reth execution client and migrates its database to v2."
59836013 echo " resync-execution"
59846014 echo " removes the execution layer database and forces a resync."
59856015 echo " resync-consensus"
@@ -6135,7 +6165,7 @@ case "${__command}" in
61356165 ;;
61366166 keys|up|start|down|stop|restart|version|logs|prune-nethermind\
61376167|prune-besu|prune-reth|prune-history|prune-lighthouse|resync-execution|resync-consensus|attach-geth\
6138- |repair-reth|keyimport|space)
6168+ |repair-reth|migrate-reth| keyimport|space)
61396169 __verify_env_file " ${__min_env_version} "
61406170 __get_compose_file
61416171 ${__command} " $@ "
Original file line number Diff line number Diff line change 175175if [[ -f /var/lib/reth/repair-trie ]]; then
176176 if [[ " ${NETWORK} " =~ ^https? :// ]]; then
177177 echo " Can't repair database on custom network"
178- rm " var/lib/reth/repair-trie"
178+ rm -f / var/lib/reth/repair-trie
179179 else
180- rm " var/lib/reth/repair-trie" # Remove first in case this panics
180+ rm -f / var/lib/reth/repair-trie # Remove first in case this panics
181181 echo " Running Reth database trie repair. This may take up to 2 hours"
182182# shellcheck disable=SC2086
183- reth db --chain " ${NETWORK} " --datadir /var/lib/reth ${__static} repair-trie
183+ exec reth db --chain " ${NETWORK} " --datadir /var/lib/reth ${__static} repair-trie
184+ fi
185+ fi
186+
187+ if [[ -f /var/lib/reth/migrate-v2 ]]; then
188+ if [[ " ${NETWORK} " =~ ^https? :// ]]; then
189+ echo " Can't migrate database on custom network"
190+ rm -f /var/lib/reth/migrate-v2
191+ else
192+ rm -f /var/lib/reth/migrate-v2 # Remove first in case this panics
193+ echo " Running Reth database migration. This may take up to 24 hours for an archive node."
194+ # shellcheck disable=SC2086
195+ exec reth db --chain " ${NETWORK} " --datadir /var/lib/reth ${__static} migrate-v2
184196 fi
185197fi
186198
You can’t perform that action at this time.
0 commit comments