From 60deb4ceeca984da5e3e613570df0b8f32a3d053 Mon Sep 17 00:00:00 2001 From: Yorick Date: Wed, 24 Apr 2024 10:01:58 +0000 Subject: [PATCH] Remove prune-geth --- ethd | 131 ++--------------------------------------------------------- 1 file changed, 3 insertions(+), 128 deletions(-) diff --git a/ethd b/ethd index 9ef759a6..178eb81c 100755 --- a/ethd +++ b/ethd @@ -441,9 +441,6 @@ Full\". Free space:" echo echo "You are running Geth and have less than 100 GiB of free disk space." echo "You may resync from scratch to use PBSS and slow on-disk DB growth, with \"$__me resync-execution\"." - echo - echo "Alternatively, if you don't feel ready for a resync and have more than 40 GiB free, you can prune \ -with \"$__me prune-geth\"." echo __display_docker_dir __display_docker_volumes @@ -1426,127 +1423,8 @@ attach-geth() { prune-geth() { - __non_interactive=0 - while : - do - if [ -z "${1+x}" ]; then - break - fi - case "$1" in - --non-interactive) - __non_interactive=1 - shift - ;; - *) - echo "Error: Unknown option: $1" >&2 - exit 1 - ;; - esac - done - if [ "${ETHD_FRONTEND:-}" = "noninteractive" ]; then - __non_interactive=1 - fi - - if [ ! -f "${ENV_FILE}" ]; then - echo "${ENV_FILE} configuration file not found, aborting." - exit 1 - fi - - if ! grep -q '^COMPOSE_FILE=.*geth\.yml' "${ENV_FILE}" 2>/dev/null ; then - echo "You do not appear to be using Geth, aborting." - exit 1 - fi - - # Check for archive node - var="ARCHIVE_NODE" - value=$(sed -n -e "s/^${var}=\(.*\)/\1/p" "${ENV_FILE}" || true) - if [[ "${value}" = "true" ]]; then - echo "Geth is an archive node: Aborting." - exit 1 - fi - - __get_docker_free_space - - if [ "${__free_space}" -lt 41943040 ]; then - echo "You do not have enough free disk space. Make sure this reads at least 40G free (Avail):" - __display_docker_dir - echo - echo "Aborting." - exit 1 - fi - - rpc_line=$(grep '^EL_RPC_PORT=' "${ENV_FILE}") - regex='^EL_RPC_PORT=([0-9]+)' - if [[ ! "${rpc_line}" =~ ${regex} ]]; then - echo "Unable to determine EL_RPC_PORT, aborting." - exit 1 - else - rpc_port="${BASH_REMATCH[1]}" - fi - - set +e - sync_status=$(docompose exec -T execution wget -qO- "http://localhost:$rpc_port" \ - --header 'Content-Type: application/json' --post-data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}') - exitstatus=$? - set -e - if [ $exitstatus -ne 0 ]; then - echo "Unable to connect to Geth: Is it running?" - echo "Output: ${sync_status}" - echo "Aborting." - exit 1 - fi - - if [[ ! "${sync_status}" =~ "false" ]]; then - echo "Geth is not done syncing yet. Sync status:" - echo "${sync_status}" - echo - echo "Aborting." - exit 1 - fi - - node_logs=$(docompose logs --no-color --tail 1000 execution) - if [[ "${node_logs}" =~ "snapshot generation" && ! "${node_logs}" =~ "Generated state" ]]; then - echo "Geth has not finished generating a state snapshot yet, aborting." - exit 1 - fi - - regex='\[([0-9][0-9]-[0-9][0-9])\|([0-9][0-9]:[0-9][0-9]):[0-9.]*\][[:space:]]*Generated state' - if [[ "${node_logs}" =~ $regex ]]; then - snap_time=$(date -d "1970-${BASH_REMATCH[1]} ${BASH_REMATCH[2]}" +"%s") - now_time=$(date +"%s") - if [ $((snap_time+2100)) -gt "$now_time" ]; then - echo "Please wait 35 minutes after snapshot generation finished. Aborting." - exit 1 - fi - fi - - if [ $__non_interactive = 0 ]; then - echo "Geth PBSS is available. Consider answering \"No\" and using \"$__me resync-execution\" instead of prune." - echo "PBSS continually prunes, making manual pruning runs a thing of the past." - echo - while true; do - read -rp "WARNING - this will stop Geth and prune its database. Do you wish to continue? (No/Yes) " yn - case $yn in - [Yy][Ee][Ss] ) break;; - * ) echo "Aborting, no changes made"; exit 130;; - esac - done - fi - - echo - echo "Starting Geth prune" - echo - docompose run --rm set-prune-marker "touch /var/lib/goethereum/prune-marker" - docompose stop execution && docompose rm -f execution - start - echo - echo "Prune is running, you can observe it with '$__me logs -f execution'" - echo - echo "There should be three stages: \"Iterating state snapshot\", \"Pruning state data\", and \"Compacting \ -database\". During the \"Compacting database\" stage it may not output logs for an hour or so, that is normal." - echo - echo "When prune is done, which takes 4-5 hours, Geth will automatically start again." - echo + echo "The legacy prune-geth command has been removed." + echo "Please resync with \"$__me resync-execution\" instead, if you aren't using PBSS already." } @@ -3290,9 +3168,6 @@ __full_help() { echo " executes an arbitrary Docker Compose command. Use \"cmd help\" to list them" echo " terminate" echo " stops the Ethereum node and destroys all data stores" - echo " prune-geth [--non-interactive]" - echo " legacy command - stops the Geth execution client and prunes its DB. This takes about 4-5 hours" - echo " consider a resync with PBSS instead, \"$__me resync-execution\"" echo " prune-nethermind [--non-interactive]" echo " restarts the Nethermind execution client and prunes its DB." echo " prune-besu [--non-interactive]" @@ -3407,7 +3282,7 @@ if ! docompose --help >/dev/null 2>&1; then fi case "$__command" in - help|config|keys|update|up|start|down|stop|restart|version|logs|cmd|terminate|prune-geth|prune-nethermind\ + help|config|keys|update|up|start|down|stop|restart|version|logs|cmd|terminate|prune-nethermind\ |prune-besu|prune-lighthouse|resync-execution|resync-consensus|attach-geth|keyimport|space) $__command "$@";; *)