Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion default.env
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,9 @@ EL_NODE_TYPE=pre-merge-expiry
# empty or "false" disables it, and any other string is assumed to be
# exact parameters for Reth's "download" function
RETH_SNAPSHOT=
# Nethermind FlatDB. Possible values empty (don't use FlatDB), flat, or flatintrie, see https://github.com/NethermindEth/nethermind/releases/tag/1.37.0
# FlatDB cannot be used with an archive node.
NETHERMIND_FLATDB=
# EraE URL, see https://github.com/eth-clients/e2store-format-specs/ and https://ethpandaops.io/data/history/
# If this URL is provided, an EL that supports EraE import will use it when fresh syncing
ERA_URL=
Expand Down Expand Up @@ -494,4 +497,4 @@ DOCKER_ROOT=/var/lib/docker
DOCKER_SOCK=/var/run/docker.sock

# Used by ethd update - please do not adjust
ENV_VERSION=55
ENV_VERSION=56
10 changes: 9 additions & 1 deletion ethd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -Eeuo pipefail
__project_name="Eth Docker"
__app_name="Ethereum node"
__sample_service="consensus"
__min_env_version=55
__min_env_version=56
__docker_exe="docker"
__old_docker=0
__docker_sudo=""
Expand Down Expand Up @@ -2856,6 +2856,14 @@ prune-nethermind() {
exit 1
fi

# Check for FlatDB
var="NETHERMIND_FLATDB"
__get_value_from_env "${var}" "${__env_file}" "__value"
if [[ -n "${__value}" ]]; then
echo "Nethermind is configured for FlatDB, which need not and cannot be pruned. Aborting."
exit 1
fi

__get_docker_free_space

var="NETWORK"
Expand Down
4 changes: 1 addition & 3 deletions nethermind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ services:
- EL_EXTRAS=${EL_EXTRAS:-}
- NODE_TYPE=${EL_NODE_TYPE:-pre-merge-expiry}
- AUTOPRUNE_NM=${AUTOPRUNE_NM:-true}
- NM_FLATDB=${NETHERMIND_FLATDB:-}
- NETWORK=${NETWORK}
# For Grandine plugin
- COMPOSE_FILE=${COMPOSE_FILE}
Expand Down Expand Up @@ -77,16 +78,13 @@ services:
- 0.0.0.0
- --JsonRpc.EnginePort
- ${EE_PORT:-8551}
- --JsonRpc.AdditionalRpcUrls=http://127.0.0.1:1337|http|admin
- --JsonRpc.JwtSecretFile=/var/lib/nethermind/ee-secret/jwtsecret
- --Metrics.Enabled
- "true"
- --Metrics.ExposeHost
- 0.0.0.0
- --Metrics.ExposePort
- "6060"
- --Pruning.FullPruningCompletionBehavior
- AlwaysShutdown
- --log
- ${LOG_LEVEL}
labels:
Expand Down
37 changes: 33 additions & 4 deletions nethermind/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,40 @@ else
__network="--config ${NETWORK}"
fi

if [[ ! "${NETWORK}" =~ ^https?:// && ! "${NODE_TYPE}" = "archive" ]]; then # Only configure prune parameters for named networks
if [[ "${NODE_TYPE}" = "archive" ]]; then
__flat=""
else
case "${NM_FLATDB}" in
"")
__flat=""
;;
flat)
echo "Enabling Nethermind FlatDB with Layout Flat"
#__flat="--FlatDb.Enabled=true --FlatDb.ImportFromPruningTrieState=true"
__flat="--FlatDb.Enabled=true"
;;
flatintrie)
echo "Enabling Nethermind FlatDB with Layout FlatInTrie"
#__flat="--FlatDb.Enabled=true --FlatDb.ImportFromPruningTrieState=true --FlatDb.Layout=FlatInTrie"
__flat="--FlatDb.Enabled=true --FlatDb.Layout=FlatInTrie"
;;
*)
__flat=""
echo "Unknown value ${NM_FLATBD} for \"NETHERMIND_FLATDB\". Continuing without FlatDB."
;;
esac
fi

__prune=""
if [[ ! "${NETWORK}" =~ ^https?:// && "${NODE_TYPE}" != "archive" && -z "${__flat}" ]]; then # Only configure prune parameters for named networks
memtotal=$(awk '/MemTotal/ {printf "%d", int($2/1024/1024)}' /proc/meminfo)
parallel=$(($(nproc)/4))
if [[ "${parallel}" -lt 2 ]]; then
parallel=2
fi
__prune="--Pruning.FullPruningMaxDegreeOfParallelism=${parallel}"
__prune="--Pruning.FullPruningMaxDegreeOfParallelism=${parallel} --Pruning.FullPruningCompletionBehavior=AlwaysShutdown --JsonRpc.AdditionalRpcUrls=http://127.0.0.1:1337|http|admin"
if [[ "${AUTOPRUNE_NM}" = true ]]; then
__prune="${__prune} --Pruning.FullPruningTrigger=VolumeFreeSpace"
__prune+=" --Pruning.FullPruningTrigger=VolumeFreeSpace"
if [[ "${NETWORK}" =~ (mainnet|gnosis) ]]; then
__prune+=" --Pruning.FullPruningThresholdMb=375810"
else
Expand Down Expand Up @@ -153,6 +178,10 @@ esac

echo "Using pruning parameters:"
echo "${__prune}"
if [[ -n "${__flat}" ]]; then
echo "Using FlatDB parameters:"
echo "${__flat}"
fi

# New or old datadir
if [[ -d /var/lib/nethermind-og/nethermind_db ]]; then
Expand Down Expand Up @@ -318,4 +347,4 @@ set -- "${__args[@]}"

# Word splitting is desired for the command line parameters
# shellcheck disable=SC2086
exec "$@" ${__datadir} ${__network} ${__prune} ${__grandine} ${EL_EXTRAS}
exec "$@" ${__datadir} ${__network} ${__prune} ${__flat} ${__grandine} ${EL_EXTRAS}
Loading