Bugfix: Handle networks with TTD=0 (e.g. withdrawal devnets)

This commit is contained in:
Zahary Karadjov 2023-01-10 19:17:11 +02:00
parent e28e1aeec8
commit 713bdd317d
No known key found for this signature in database
GPG Key ID: C1F42EAFF38D570F
2 changed files with 44 additions and 2 deletions

View File

@ -1458,9 +1458,12 @@ proc findTerminalBlock(provider: Web3DataProviderRef,
provider.web3.provider.eth_getBlockByNumber("latest", false))
b = await next(a)
if a.number.uint64 == 0 and a.totalDifficulty >= ttd:
return a
while true:
let one = a.totalDifficulty > ttd
let two = b.totalDifficulty > ttd
let one = a.totalDifficulty >= ttd
let two = b.totalDifficulty >= ttd
if one != two:
step = step div -2i64
if step == 0:

View File

@ -0,0 +1,39 @@
#!/usr/bin/env bash
if [ -z "$1" ]; then
echo "Usage: run-nimbus-eth2-in-withdrawal-testnet.sh <network-metadata-dir>"
exit 1
fi
if [ ! -d "$1" ]; then
echo "Please supply a valid network metadata directory"
exit 1
fi
set -Eeu
NETWORK=$(cd "$1"; pwd)
cd $(dirname "$0")
source repo_paths.sh
DATA_DIR="$(create_data_dir_for_network "$NETWORK")"
JWT_TOKEN="$DATA_DIR/jwt-token"
create_jwt_token "$JWT_TOKEN"
"$BUILD_DIR/nimbus_beacon_node" \
--non-interactive \
--udp-port=19000 \
--tcp-port=19000 \
--network="$NETWORK" \
--log-level=DEBUG \
--data-dir="$DATA_DIR/nimbus_bn" \
--el=http://localhost:18550/ \
--rest:on \
--rest-port=15052 \
--metrics=on \
--metrics-port=18008 \
--doppelganger-detection=no \
--jwt-secret="$JWT_TOKEN"