Skip to content
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
93fb6f3
Temp hack to compile
pawanjay176 Mar 23, 2023
0b92b20
Fix doppelganger tests
pawanjay176 Mar 23, 2023
e2e9ea9
Kill in groups instead of storing pid
pawanjay176 Mar 23, 2023
29465a6
Install geth in CI
pawanjay176 Mar 23, 2023
5085793
Install geth first
pawanjay176 Mar 23, 2023
0b3e8d3
Fix eth1_block_hash
pawanjay176 Mar 23, 2023
72d1f53
Fix directory paths and block hash
pawanjay176 Mar 23, 2023
41f87ac
Fix workflow for local testnets; reset genesis.json after running script
pawanjay176 Mar 23, 2023
d3e7f48
Disable capella and deneb forks for doppelganger tests
pawanjay176 Mar 23, 2023
9e7002d
oops not capella
pawanjay176 Mar 23, 2023
eb87a12
Spin up a spare bn for the doppelganger validator
pawanjay176 Mar 24, 2023
14eb178
testing
pawanjay176 Mar 24, 2023
3e8cf1a
Revert "testing"
pawanjay176 Mar 27, 2023
0be1f4c
Modify beacon_node script to take trusted peers
pawanjay176 Mar 27, 2023
a229855
Set doppelganger bn as a trusted peer
pawanjay176 Mar 27, 2023
9cc6f0a
Merge branch 'deneb-free-blobs' into fix-deneb-dg
pawanjay176 Mar 27, 2023
2213b83
Update var
pawanjay176 Mar 27, 2023
17c0c5c
update another
pawanjay176 Mar 27, 2023
950273a
Fix port
pawanjay176 Mar 27, 2023
03cb422
Add a flag to disable peer scoring
pawanjay176 Mar 27, 2023
e55b968
Merge branch 'disable-scoring-flag' into fix-deneb-dg
pawanjay176 Mar 27, 2023
62c4bf9
Merge branch 'deneb-free-blobs' into fix-deneb-dg
pawanjay176 Apr 21, 2023
0e2a3d3
Disable peer scoring in local testnet bn script
pawanjay176 Apr 21, 2023
be8b61b
Revert trusted peers hack
pawanjay176 Apr 21, 2023
e1b0fe9
fmt
pawanjay176 Apr 21, 2023
0d89694
Fix proposer boost score
pawanjay176 Apr 26, 2023
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
11 changes: 10 additions & 1 deletion .github/workflows/local-testnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,16 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install ganache
run: npm install ganache@latest --global

- name: Install geth

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @atokama. We are using this for testing for 4844 specific stuff. This might not get merged for quite some time to the main branch. We have another PR #3807 where we should be ideally adding this and updating the docs for building post merge local testnets. Haven't been able to get around to that yet though 😅

run: |
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install ethereum
if: matrix.os == 'ubuntu-22.04'
run: |
brew tap ethereum/ethereum
brew install ethereum
if: matrix.os == 'macos-12'
- name: Install GNU sed & GNU grep
run: |
brew install gnu-sed grep
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -260,20 +260,23 @@ jobs:
uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install ganache
run: sudo npm install -g ganache
- name: Install geth
run: |
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install ethereum
- name: Install lighthouse and lcli
run: |
make
make install-lcli
- name: Run the doppelganger protection success test script
run: |
cd scripts/tests
./doppelganger_protection.sh success
./doppelganger_protection.sh success genesis.json
- name: Run the doppelganger protection failure test script
run: |
cd scripts/tests
./doppelganger_protection.sh failure
./doppelganger_protection.sh failure genesis.json
execution-engine-integration-ubuntu:
name: execution-engine-integration-ubuntu
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions scripts/local_testnet/beacon_node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ exec $lighthouse_binary \
--datadir $data_dir \
--testnet-dir $TESTNET_DIR \
--enable-private-discovery \
--disable-peer-scoring \
--staking \
--enr-address 127.0.0.1 \
--enr-udp-port $network_port \
Expand Down
2 changes: 1 addition & 1 deletion scripts/local_testnet/el_bootnode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ priv_key="02fd74636e96a8ffac8e7b01b0de8dea94d6bcf4989513b38cf59eb32163ff91"

source ./vars.env

$BOOTNODE_BINARY --nodekeyhex $priv_key
$EL_BOOTNODE_BINARY --nodekeyhex $priv_key
6 changes: 4 additions & 2 deletions scripts/local_testnet/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,7 @@ GENESIS_TIME=$(lcli pretty-ssz state_merge ~/.lighthouse/local-testnet/testnet/g
CAPELLA_TIME=$((GENESIS_TIME + (CAPELLA_FORK_EPOCH * 32 * SECONDS_PER_SLOT)))
DENEB_TIME=$((GENESIS_TIME + (DENEB_FORK_EPOCH * 32 * SECONDS_PER_SLOT)))

sed -i 's/"shanghaiTime".*$/"shanghaiTime": '"$CAPELLA_TIME"',/g' genesis.json
sed -i 's/"shardingForkTime".*$/"shardingForkTime": '"$DENEB_TIME"',/g' genesis.json
CURR_DIR=`pwd`

sed -i 's/"shanghaiTime".*$/"shanghaiTime": '"$CAPELLA_TIME"',/g' $CURR_DIR/genesis.json
sed -i 's/"shardingForkTime".*$/"shardingForkTime": '"$DENEB_TIME"',/g' $CURR_DIR/genesis.json
2 changes: 1 addition & 1 deletion scripts/local_testnet/vars.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
GETH_BINARY=geth
BOOTNODE_BINARY=bootnode
EL_BOOTNODE_BINARY=bootnode

# Base directories for the validator keys and secrets
DATADIR=~/.lighthouse/local-testnet
Expand Down
51 changes: 27 additions & 24 deletions scripts/tests/doppelganger_protection.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

# Requires `lighthouse`, ``lcli`, `ganache`, `curl`, `jq`
# Requires `lighthouse`, ``lcli`, `geth`, `curl`, `jq`


BEHAVIOR=$1
Expand All @@ -15,21 +15,15 @@ exit_if_fails() {
$@
EXIT_CODE=$?
if [[ $EXIT_CODE -eq 1 ]]; then
exit 111
exit 1
fi
}
genesis_file=$2

source ./vars.env

exit_if_fails ../local_testnet/clean.sh

echo "Starting ganache"

exit_if_fails ../local_testnet/ganache_test_node.sh &> /dev/null &
GANACHE_PID=$!

# Wait for ganache to start
sleep 5

echo "Setting up local testnet"

Expand All @@ -41,28 +35,33 @@ exit_if_fails cp -R $HOME/.lighthouse/local-testnet/node_1 $HOME/.lighthouse/loc
echo "Starting bootnode"

exit_if_fails ../local_testnet/bootnode.sh &> /dev/null &
BOOT_PID=$!

exit_if_fails ../local_testnet/el_bootnode.sh &> /dev/null &

# wait for the bootnode to start
sleep 10

echo "Starting local beacon nodes"
echo "Starting local execution nodes"

exit_if_fails ../local_testnet/beacon_node.sh $HOME/.lighthouse/local-testnet/node_1 9000 8000 &> /dev/null &
BEACON_PID=$!
exit_if_fails ../local_testnet/beacon_node.sh $HOME/.lighthouse/local-testnet/node_2 9100 8100 &> /dev/null &
BEACON_PID2=$!
exit_if_fails ../local_testnet/beacon_node.sh $HOME/.lighthouse/local-testnet/node_3 9200 8200 &> /dev/null &
BEACON_PID3=$!
exit_if_fails ../local_testnet/geth.sh $HOME/.lighthouse/local-testnet/geth_datadir1 7000 6000 5000 $genesis_file &> geth.log &
exit_if_fails ../local_testnet/geth.sh $HOME/.lighthouse/local-testnet/geth_datadir2 7100 6100 5100 $genesis_file &> /dev/null &
exit_if_fails ../local_testnet/geth.sh $HOME/.lighthouse/local-testnet/geth_datadir3 7200 6200 5200 $genesis_file &> /dev/null &

sleep 20

# Reset the `genesis.json` config file fork times.
sed -i 's/"shanghaiTime".*$/"shanghaiTime": 0,/g' genesis.json
sed -i 's/"shardingForkTime".*$/"shardingForkTime": 0,/g' genesis.json

exit_if_fails ../local_testnet/beacon_node.sh $HOME/.lighthouse/local-testnet/node_1 9000 8000 http://localhost:5000 $HOME/.lighthouse/local-testnet/geth_datadir1/geth/jwtsecret &> /dev/null &
exit_if_fails ../local_testnet/beacon_node.sh $HOME/.lighthouse/local-testnet/node_2 9100 8100 http://localhost:5100 $HOME/.lighthouse/local-testnet/geth_datadir2/geth/jwtsecret &> beacon1.log &
exit_if_fails ../local_testnet/beacon_node.sh $HOME/.lighthouse/local-testnet/node_3 9200 8200 http://localhost:5200 $HOME/.lighthouse/local-testnet/geth_datadir3/geth/jwtsecret &> /dev/null &

echo "Starting local validator clients"

exit_if_fails ../local_testnet/validator_client.sh $HOME/.lighthouse/local-testnet/node_1 http://localhost:8000 &> /dev/null &
VALIDATOR_1_PID=$!
exit_if_fails ../local_testnet/validator_client.sh $HOME/.lighthouse/local-testnet/node_2 http://localhost:8100 &> /dev/null &
VALIDATOR_2_PID=$!
exit_if_fails ../local_testnet/validator_client.sh $HOME/.lighthouse/local-testnet/node_3 http://localhost:8200 &> /dev/null &
VALIDATOR_3_PID=$!

echo "Waiting an epoch before starting the next validator client"
sleep $(( $SECONDS_PER_SLOT * 32 ))
Expand All @@ -71,15 +70,17 @@ if [[ "$BEHAVIOR" == "failure" ]]; then

echo "Starting the doppelganger validator client"

# Use same keys as keys from VC1, but connect to BN2
# Use same keys as keys from VC1 and connect to BN2
# This process should not last longer than 2 epochs
timeout $(( $SECONDS_PER_SLOT * 32 * 2 )) ../local_testnet/validator_client.sh $HOME/.lighthouse/local-testnet/node_1_doppelganger http://localhost:8100
DOPPELGANGER_EXIT=$?

echo "Shutting down"

# Cleanup
kill $BOOT_PID $BEACON_PID $BEACON_PID2 $BEACON_PID3 $GANACHE_PID $VALIDATOR_1_PID $VALIDATOR_2_PID $VALIDATOR_3_PID
killall geth
killall lighthouse
killall bootnode

echo "Done"

Expand All @@ -98,7 +99,6 @@ if [[ "$BEHAVIOR" == "success" ]]; then
echo "Starting the last validator client"

../local_testnet/validator_client.sh $HOME/.lighthouse/local-testnet/node_4 http://localhost:8100 &
VALIDATOR_4_PID=$!
DOPPELGANGER_FAILURE=0

# Sleep three epochs, then make sure all validators were active in epoch 2. Use
Expand Down Expand Up @@ -144,7 +144,10 @@ if [[ "$BEHAVIOR" == "success" ]]; then

# Cleanup
cd $PREVIOUS_DIR
kill $BOOT_PID $BEACON_PID $BEACON_PID2 $BEACON_PID3 $GANACHE_PID $VALIDATOR_1_PID $VALIDATOR_2_PID $VALIDATOR_3_PID $VALIDATOR_4_PID

killall geth
killall lighthouse
killall bootnode

echo "Done"

Expand Down
Loading