Avoid persisting lighthouse bootnode ENR between restarts (#377)

This commit is contained in:
prathamesh0 2023-05-02 12:14:48 +05:30 committed by GitHub
parent 2c57fd2122
commit cba2345af3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 17 deletions

View File

@ -64,8 +64,6 @@ services:
environment: environment:
RUN_BOOTNODE: "true" RUN_BOOTNODE: "true"
image: cerc/fixturenet-eth-lighthouse:local image: cerc/fixturenet-eth-lighthouse:local
volumes:
- fixturenet_eth_bootnode_lighthouse_data:/opt/testnet/build/cl
fixturenet-eth-lighthouse-1: fixturenet-eth-lighthouse-1:
hostname: fixturenet-eth-lighthouse-1 hostname: fixturenet-eth-lighthouse-1
@ -120,6 +118,5 @@ volumes:
fixturenet_eth_bootnode_geth_data: fixturenet_eth_bootnode_geth_data:
fixturenet_eth_geth_1_data: fixturenet_eth_geth_1_data:
fixturenet_eth_geth_2_data: fixturenet_eth_geth_2_data:
fixturenet_eth_bootnode_lighthouse_data:
fixturenet_eth_lighthouse_1_data: fixturenet_eth_lighthouse_1_data:
fixturenet_eth_lighthouse_2_data: fixturenet_eth_lighthouse_2_data:

View File

@ -21,22 +21,14 @@ if [ ! -f "$DATADIR/bootnode/enr.dat" ]; then
--udp-port $BOOTNODE_PORT \ --udp-port $BOOTNODE_PORT \
--tcp-port $BOOTNODE_PORT \ --tcp-port $BOOTNODE_PORT \
--genesis-fork-version $GENESIS_FORK_VERSION \ --genesis-fork-version $GENESIS_FORK_VERSION \
--output-dir $DATADIR/bootnode-temp --output-dir $DATADIR/bootnode
# Output ENR to a temp dir and mv as "lcli generate-bootnode-enr" will not overwrite an empty dir (mounted volume) bootnode_enr=`cat $DATADIR/bootnode/enr.dat`
mkdir -p $DATADIR/bootnode echo "- $bootnode_enr" > $TESTNET_DIR/boot_enr.yaml
mv $DATADIR/bootnode-temp/* $DATADIR/bootnode
rm -r $DATADIR/bootnode-temp
echo "Generated bootnode enr" echo "Generated bootnode enr and written to $TESTNET_DIR/boot_enr.yaml"
else
echo "Found existing bootnode enr"
fi fi
bootnode_enr=`cat $DATADIR/bootnode/enr.dat`
echo "- $bootnode_enr" > $TESTNET_DIR/boot_enr.yaml
echo "Written bootnode enr to $TESTNET_DIR/boot_enr.yaml"
exec lighthouse boot_node \ exec lighthouse boot_node \
--testnet-dir $TESTNET_DIR \ --testnet-dir $TESTNET_DIR \
--port $BOOTNODE_PORT \ --port $BOOTNODE_PORT \

View File

@ -117,8 +117,8 @@ Clear volumes created by this stack:
```bash ```bash
# List all relevant volumes # List all relevant volumes
$ docker volume ls -q --filter "name=.*fixturenet_eth_bootnode_geth_data|.*fixturenet_eth_bootnode_lighthouse_data|.*fixturenet_eth_geth_1_data|.*fixturenet_eth_geth_2_data|.*fixturenet_eth_lighthouse_1_data|.*fixturenet_eth_lighthouse_2_data" $ docker volume ls -q --filter "name=.*fixturenet_eth_bootnode_geth_data|.*fixturenet_eth_geth_1_data|.*fixturenet_eth_geth_2_data|.*fixturenet_eth_lighthouse_1_data|.*fixturenet_eth_lighthouse_2_data"
# Remove all the listed volumes # Remove all the listed volumes
$ docker volume rm $(docker volume ls -q --filter "name=.*fixturenet_eth_bootnode_geth_data|.*fixturenet_eth_bootnode_lighthouse_data|.*fixturenet_eth_geth_1_data|.*fixturenet_eth_geth_2_data|.*fixturenet_eth_lighthouse_1_data|.*fixturenet_eth_lighthouse_2_data") $ docker volume rm $(docker volume ls -q --filter "name=.*fixturenet_eth_bootnode_geth_data|.*fixturenet_eth_geth_1_data|.*fixturenet_eth_geth_2_data|.*fixturenet_eth_lighthouse_1_data|.*fixturenet_eth_lighthouse_2_data")
``` ```