fixup! Allow the creation of stale nodes on local testnets #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Test that local testnet starts successfully. | |
name: local testnet | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- unstable | |
- fix_fork_revert | |
pull_request: | |
merge_group: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
run-local-testnet: | |
strategy: | |
matrix: | |
os: | |
- ubuntu-22.04 | |
- macos-12 | |
runs-on: ${{ matrix.os }} | |
env: | |
# Enable portable to prevent issues with caching `blst` for the wrong CPU type | |
FEATURES: portable,jemalloc | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get latest version of stable Rust | |
run: rustup update stable | |
- name: Install geth (ubuntu) | |
if: matrix.os == 'ubuntu-22.04' | |
run: | | |
sudo add-apt-repository -y ppa:ethereum/ethereum | |
sudo apt-get update | |
sudo apt-get install ethereum | |
- name: Install geth (mac) | |
if: matrix.os == 'macos-12' | |
run: | | |
brew tap ethereum/ethereum | |
brew install ethereum | |
- name: Install GNU sed & GNU grep | |
if: matrix.os == 'macos-12' | |
run: | | |
brew install gnu-sed grep | |
echo "$(brew --prefix)/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH | |
echo "$(brew --prefix)/opt/grep/libexec/gnubin" >> $GITHUB_PATH | |
# https://github.com/actions/cache/blob/main/examples.md#rust---cargo | |
- uses: actions/cache@v3 | |
id: cache-cargo | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install lighthouse | |
run: make && make install-lcli | |
- name: Start local testnet | |
run: ./start_local_testnet.sh genesis.json && sleep 60 | |
working-directory: scripts/local_testnet | |
- name: Print logs | |
run: ./dump_logs.sh | |
working-directory: scripts/local_testnet | |
- name: Stop local testnet | |
run: ./stop_local_testnet.sh | |
working-directory: scripts/local_testnet | |
- name: Clean-up testnet | |
run: ./clean.sh | |
working-directory: scripts/local_testnet | |
- name: Start local testnet with blinded block production | |
run: ./start_local_testnet.sh -p genesis.json && sleep 60 | |
working-directory: scripts/local_testnet | |
- name: Print logs for blinded block testnet | |
run: ./dump_logs.sh | |
working-directory: scripts/local_testnet | |
- name: Stop local testnet with blinded block production | |
run: ./stop_local_testnet.sh | |
working-directory: scripts/local_testnet | |
test-fork-revert-logic: | |
strategy: | |
matrix: | |
os: | |
- ubuntu-22.04 | |
- macos-12 | |
runs-on: ${{ matrix.os }} | |
env: | |
# Enable portable to prevent issues with caching `blst` for the wrong CPU type | |
FEATURES: portable,jemalloc | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get latest version of stable Rust | |
run: rustup update stable | |
- name: Install geth (ubuntu) | |
if: matrix.os == 'ubuntu-22.04' | |
run: | | |
sudo add-apt-repository -y ppa:ethereum/ethereum | |
sudo apt-get update | |
sudo apt-get install ethereum | |
- name: Install geth (mac) | |
if: matrix.os == 'macos-12' | |
run: | | |
brew tap ethereum/ethereum | |
brew install ethereum | |
- name: Install GNU sed & GNU grep | |
if: matrix.os == 'macos-12' | |
run: | | |
brew install gnu-sed grep | |
echo "$(brew --prefix)/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH | |
echo "$(brew --prefix)/opt/grep/libexec/gnubin" >> $GITHUB_PATH | |
# This installs the latest release available on github. This will be the | |
# 'old' version the stale nodes will run. Since the code we're testing is | |
# the newest version, the latest release would be the previous version. | |
- name: Install latest lighthouse release as lighthouse_prev | |
run: sudo ./install_latest_release.sh -p /usr/local/bin/lighthouse_prev | |
working-directory: scripts/ | |
# https://github.com/actions/cache/blob/main/examples.md#rust---cargo | |
- uses: actions/cache@v3 | |
id: cache-cargo | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install lighthouse | |
run: make && make install-lcli | |
# Starts the testnet with 2 stale nodes. The 400 seconds sleep should be | |
# enough for the hardforks to happen on the non-stale nodes and to finalize. | |
# (3 secs per slot * 32 slots per epoch * 2 epochs + 2 epochs to finalize = 384) | |
# (these values are defined in genesis.json, vars.env and setup_time.sh) | |
- name: Start local testnet | |
run: | | |
STALE_BN_COUNT=2 | |
sed -i "s/STALE_BN_COUNT=0/STALE_BN_COUNT=${STALE_BN_COUNT}/" ./vars.env | |
./start_local_testnet.sh genesis.json && sleep 400 | |
working-directory: scripts/local_testnet | |
- name: Stop stale nodes | |
run: ./stop_stale_nodes.sh | |
working-directory: scripts/local_testnet | |
# Not sure about the 200 here. This should be enough time for the | |
# stale nodes to catch up. | |
- name: Update stale nodes | |
run: ./update_stale_nodes.sh genesis.json && sleep 200 | |
working-directory: scripts/local_testnet | |
- name: Print logs | |
run: ./dump_logs.sh | |
working-directory: scripts/local_testnet | |
- name: Stop local testnet | |
run: ./stop_local_testnet.sh | |
working-directory: scripts/local_testnet | |
- name: Clean-up testnet | |
run: ./clean.sh | |
working-directory: scripts/local_testnet | |
- name: Start local testnet with blinded block production | |
run: ./start_local_testnet.sh -p genesis.json && sleep 60 | |
working-directory: scripts/local_testnet | |
- name: Stop stale nodes | |
run: ./stop_stale_nodes.sh | |
working-directory: scripts/local_testnet | |
# Not sure about the 200 here. This should be enough time for the | |
# stale nodes to catch up. | |
- name: Update stale nodes | |
run: ./update_stale_nodes.sh genesis.json && sleep 200 | |
working-directory: scripts/local_testnet | |
- name: Print logs for blinded block testnet | |
run: ./dump_logs.sh | |
working-directory: scripts/local_testnet | |
- name: Stop local testnet with blinded block production | |
run: ./stop_local_testnet.sh | |
working-directory: scripts/local_testnet | |
# This job succeeds ONLY IF all others succeed. It is used by the merge queue to determine whether | |
# a PR is safe to merge. New jobs should be added here. | |
local-testnet-success: | |
name: local-testnet-success | |
runs-on: ubuntu-latest | |
needs: [ | |
"run-local-testnet", | |
"test-fork-revert-logic", | |
] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Check that success job is dependent on all others | |
run: ./scripts/ci/check-success-job.sh ./.github/workflows/local-testnet.yml local-testnet-success | |