Remove fixed IPs and separate network for fixturenet. #30

Merged
telackey merged 7 commits from telackey/netfix into main 2022-10-31 17:43:49 +00:00
8 changed files with 39 additions and 47 deletions
Showing only changes of commit 366cb7684e - Show all commits

View File

@ -8,9 +8,6 @@ services:
environment:
RUN_BOOTNODE: "true"
image: cerc/fixturenet-eth-geth:local
networks:
fixturenet-eth-net:
ipv4_address: 172.16.254.10
fixturenet-eth-geth-1:
hostname: fixturenet-eth-geth-1
@ -20,9 +17,7 @@ services:
depends_on:
- fixturenet-eth-bootnode-geth
ports:
- "8545"
networks:
fixturenet-eth-net:
- "8545:8545"
fixturenet-eth-geth-2:
hostname: fixturenet-eth-geth-2
@ -31,17 +26,12 @@ services:
image: cerc/fixturenet-eth-geth:local
depends_on:
- fixturenet-eth-bootnode-geth
networks:
fixturenet-eth-net:
fixturenet-eth-bootnode-lighthouse:
hostname: fixturenet-eth-bootnode-lighthouse
environment:
RUN_BOOTNODE: "true"
image: cerc/fixturenet-eth-lighthouse:local
networks:
fixturenet-eth-net:
ipv4_address: 172.16.254.11
fixturenet-eth-lighthouse-1:
hostname: fixturenet-eth-lighthouse-1
@ -56,9 +46,7 @@ services:
- fixturenet-eth-bootnode-lighthouse
- fixturenet-eth-geth-1
ports:
- "8001"
networks:
fixturenet-eth-net:
- "5052:8001"
fixturenet-eth-lighthouse-2:
hostname: fixturenet-eth-lighthouse-2
@ -73,14 +61,3 @@ services:
depends_on:
- fixturenet-eth-bootnode-lighthouse
- fixturenet-eth-geth-2
networks:
fixturenet-eth-net:
networks:
# When the bootnode ENR is generated during the build, it requires a specific IP.
# The easiest way to do that is to use a private network.
fixturenet-eth-net:
driver: bridge
ipam:
config:
- subnet: 172.16.254.0/28

View File

@ -7,5 +7,4 @@ ENODE="enode://af22c29c316ad069cf48a09a4ad5cf04a251b411e45098888d114c6dd7f489a13
# JWT shared by geth and lighthouse for authentication.
JWT="0x6cdcac3501046a08e186730dd8bd136cfaf0fdc1fc955f6e15ad3068c0ff2af0"
# Should match the definition of fixturenet-eth-net.
NETRESTRICT="172.16.254.0/28"
ENR_URL="http://fixturenet-eth-bootnode-lighthouse:3000/bootnode/enr.dat"

View File

@ -2,6 +2,7 @@
ETHERBASE=`cat /opt/testnet/build/el/accounts.csv | head -1 | cut -d',' -f2`
NETWORK_ID=`cat /opt/testnet/el/el-config.yaml | grep 'chain_id' | awk '{ print $2 }'`
NETRESTRICT=`ip addr | grep inet | grep -v '127.0' | awk '{print $2}'`
if [ "true" == "$RUN_BOOTNODE" ]; then
geth \

View File

@ -10,7 +10,7 @@ set -Eeuo pipefail
source ./vars.env
SUBSCRIBE_ALL_SUBNETS=
DEBUG_LEVEL=${DEBUG_LEVEL:-info}
DEBUG_LEVEL=${DEBUG_LEVEL:-debug}
# Get positional arguments
data_dir=$DATADIR/node_${NODE_NUMBER}
@ -18,9 +18,6 @@ network_port=9001
http_port=8001
authrpc_port=8551
ENR=`cat $DATADIR/bootnode/enr.dat`
ENR_IP=`ip addr | grep 172 | awk '{print $2}' | cut -d '/' -f1`
exec lighthouse \
--debug-level $DEBUG_LEVEL \
bn \

View File

@ -13,6 +13,22 @@ DEBUG_LEVEL=${1:-info}
echo "Starting bootnode"
if [ ! -f "$DATADIR/bootnode/enr.dat" ]; then
echo "Generating bootnode enr"
lcli \
generate-bootnode-enr \
--ip $ENR_IP \
--udp-port $BOOTNODE_PORT \
--tcp-port $BOOTNODE_PORT \
--genesis-fork-version $GENESIS_FORK_VERSION \
--output-dir $DATADIR/bootnode
bootnode_enr=`cat $DATADIR/bootnode/enr.dat`
echo "- $bootnode_enr" > $TESTNET_DIR/boot_enr.yaml
echo "Generated bootnode enr and written to $TESTNET_DIR/boot_enr.yaml"
fi
exec lighthouse boot_node \
--testnet-dir $TESTNET_DIR \
--port $BOOTNODE_PORT \

View File

@ -57,18 +57,3 @@ lcli \
$GENESIS_VALIDATOR_COUNT
echo Created genesis state in $TESTNET_DIR
echo "Generating bootnode enr"
lcli \
generate-bootnode-enr \
--ip $BOOTNODE_IP \
--udp-port $BOOTNODE_PORT \
--tcp-port $BOOTNODE_PORT \
--genesis-fork-version $GENESIS_FORK_VERSION \
--output-dir $DATADIR/bootnode
bootnode_enr=`cat $DATADIR/bootnode/enr.dat`
echo "- $bootnode_enr" > $TESTNET_DIR/boot_enr.yaml
echo "Generated bootnode enr and written to $TESTNET_DIR/boot_enr.yaml"

View File

@ -4,6 +4,8 @@ DATADIR=${DATADIR:-../build/cl}
# Directory for the eth2 config
TESTNET_DIR=${TESTNET_DIR:-$DATADIR/testnet}
JWTSECRET=${JWTSECRET:-$DATADIR/jwtsecret}
ENR=${ENR:="SET_AT_RUNTIME"}
ENR_IP=`ip addr | grep inet | grep -v '127.0.0.1' | sort | head -1 | awk '{print $2}' | cut -d '/' -f1`
GENESIS_FORK_VERSION=${GENESIS_FORK_VERSION:-0x12121212}
@ -22,7 +24,6 @@ VC_COUNT=${VC_COUNT:-$BN_COUNT}
GENESIS_DELAY=${GENESIS_DELAY:-0}
# Port for P2P communication with bootnode
BOOTNODE_IP=${BOOTNODE_IP:-172.16.254.11}
BOOTNODE_PORT=${BOOTNODE_PORT:-4242}
# Hard fork configuration

View File

@ -1,6 +1,10 @@
#!/bin/bash
if [ "true" == "$RUN_BOOTNODE" ]; then
cd /opt/testnet/build/cl
python3 -m http.server 3000 &
cd /opt/testnet/cl
./bootnode.sh 2>&1 | tee /var/log/lighthouse_bootnode.log
else
@ -34,6 +38,18 @@ else
done
fi
if [ ! -z "$ENR_URL" ]; then
while [ 1 -eq 1 ]; do
echo "Waiting on ENR for boot node..."
sleep 5
result=`wget --no-check-certificate --quiet -O - --timeout=0 $ENR_URL`
if [ ! -z "$result" ]; then
export ENR="$result"
break;
fi
done
fi
export JWTSECRET="/opt/testnet/build/cl/jwtsecret"
echo -n "$JWT" > $JWTSECRET