Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace local testnet script with Kurtosis #5865

Merged
merged 13 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
179 changes: 123 additions & 56 deletions .github/workflows/local-testnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,87 +13,154 @@ concurrency:
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
dockerfile-ubuntu:
runs-on: ${{ github.repository == 'sigp/lighthouse' && fromJson('["self-hosted", "linux", "CI", "large"]') || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v4

- 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'
- name: Build Docker image
run: |
brew tap ethereum/ethereum
brew install ethereum
- name: Install GNU sed & GNU grep
if: matrix.os == 'macos-12'
docker build --build-arg FEATURES=portable -t lighthouse:local .
docker save lighthouse:local -o lighthouse-docker.tar

- name: Upload Docker image artifact
uses: actions/upload-artifact@v4
with:
name: lighthouse-docker
path: lighthouse-docker.tar
retention-days: 3

run-local-testnet:
runs-on: ubuntu-22.04
needs: dockerfile-ubuntu
steps:
- uses: actions/checkout@v4

- name: Install dependencies
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@v4
id: cache-cargo
sudo add-apt-repository ppa:rmescandon/yq
echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list
sudo apt update
sudo apt install -y kurtosis-cli yq
kurtosis analytics disable

- name: Download Docker image artifact
uses: actions/download-artifact@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
name: lighthouse-docker
path: .

- name: Install lighthouse
run: make && make install-lcli
- name: Load Docker image
run: docker load -i lighthouse-docker.tar

- name: Start local testnet
run: ./start_local_testnet.sh genesis.json && sleep 60
run: ./start_local_testnet.sh -e local -c -b false && sleep 60
working-directory: scripts/local_testnet

- name: Print logs
run: ./dump_logs.sh
- name: Stop local testnet and dump logs
run: ./stop_local_testnet.sh local
working-directory: scripts/local_testnet

- name: Stop local testnet
run: ./stop_local_testnet.sh
- name: Start local testnet with blinded block production
run: ./start_local_testnet.sh -e local-blinded -c -p -b false && sleep 60
working-directory: scripts/local_testnet

- name: Clean-up testnet
run: ./clean.sh
- name: Stop local testnet and dump logs
run: ./stop_local_testnet.sh local-blinded
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: Upload logs artifact
uses: actions/upload-artifact@v4
with:
name: logs-local-testnet
path: |
scripts/local_testnet/logs
retention-days: 3

- name: Print logs for blinded block testnet
run: ./dump_logs.sh
working-directory: scripts/local_testnet
doppelganger-protection-success-test:
needs: dockerfile-ubuntu
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo add-apt-repository ppa:rmescandon/yq
echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list
sudo apt update
sudo apt install -y kurtosis-cli yq
kurtosis analytics disable

- name: Download Docker image artifact
uses: actions/download-artifact@v4
with:
name: lighthouse-docker
path: .

- name: Load Docker image
run: docker load -i lighthouse-docker.tar

- name: Run the doppelganger protection success test script
run: |
./doppelganger_protection.sh success
working-directory: scripts/tests

- name: Upload logs artifact
uses: actions/upload-artifact@v4
with:
name: logs-doppelganger-protection-success
path: |
scripts/local_testnet/logs
retention-days: 3

doppelganger-protection-failure-test:
needs: dockerfile-ubuntu
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo add-apt-repository ppa:rmescandon/yq
echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list
sudo apt update
sudo apt install -y kurtosis-cli yq
kurtosis analytics disable

- name: Download Docker image artifact
uses: actions/download-artifact@v4
with:
name: lighthouse-docker
path: .

- name: Load Docker image
run: docker load -i lighthouse-docker.tar

- name: Run the doppelganger protection failure test script
run: |
./doppelganger_protection.sh failure
working-directory: scripts/tests

- name: Upload logs artifact
uses: actions/upload-artifact@v4
with:
name: logs-doppelganger-protection-failure
path: |
scripts/local_testnet/logs
retention-days: 3

- 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"]
needs: [
'dockerfile-ubuntu',
'run-local-testnet',
'doppelganger-protection-success-test',
'doppelganger-protection-failure-test',
]
steps:
- uses: actions/checkout@v4
- name: Check that success job is dependent on all others
Expand Down
48 changes: 0 additions & 48 deletions .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -259,17 +259,6 @@ jobs:
- name: Show cache stats
if: env.SELF_HOSTED_RUNNERS == 'true'
run: sccache --show-stats
dockerfile-ubuntu:
name: dockerfile-ubuntu
needs: [check-labels]
if: needs.check-labels.outputs.skip_ci != 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build the root Dockerfile
run: docker build --build-arg FEATURES=portable -t lighthouse:local .
- name: Test the built image
run: docker run -t lighthouse:local lighthouse --version
basic-simulator-ubuntu:
name: basic-simulator-ubuntu
needs: [check-labels]
Expand Down Expand Up @@ -298,41 +287,6 @@ jobs:
cache-target: release
- name: Run a beacon chain sim which tests VC fallback behaviour
run: cargo run --release --bin simulator fallback-sim
doppelganger-protection-test:
name: doppelganger-protection-test
needs: [check-labels]
if: needs.check-labels.outputs.skip_ci != 'true'
runs-on: ${{ github.repository == 'sigp/lighthouse' && fromJson('["self-hosted", "linux", "CI", "small"]') || 'ubuntu-latest' }}
env:
# Enable portable to prevent issues with caching `blst` for the wrong CPU type
FEATURES: jemalloc,portable
steps:
- uses: actions/checkout@v4
- name: Get latest version of stable Rust
if: env.SELF_HOSTED_RUNNERS == 'false'
uses: moonrepo/setup-rust@v1
with:
channel: stable
cache-target: release
- name: Install geth
if: env.SELF_HOSTED_RUNNERS == 'false'
run: |
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install ethereum
- name: Install lighthouse
run: |
make
- name: Install lcli
run: make install-lcli
- name: Run the doppelganger protection failure test script
run: |
cd scripts/tests
./doppelganger_protection.sh failure genesis.json
- name: Run the doppelganger protection success test script
run: |
cd scripts/tests
./doppelganger_protection.sh success genesis.json
execution-engine-integration-ubuntu:
name: execution-engine-integration-ubuntu
needs: [check-labels]
Expand Down Expand Up @@ -465,10 +419,8 @@ jobs:
'debug-tests-ubuntu',
'state-transition-vectors-ubuntu',
'ef-tests-ubuntu',
'dockerfile-ubuntu',
'basic-simulator-ubuntu',
'fallback-simulator-ubuntu',
'doppelganger-protection-test',
'execution-engine-integration-ubuntu',
'check-code',
'check-msrv',
Expand Down
3 changes: 0 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions beacon_node/genesis/tests/tests.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
//! NOTE: These tests will not pass unless an anvil is running on `ENDPOINT` (see below).
//!
//! You can start a suitable instance using the `anvil_test_node.sh` script in the `scripts`
//! dir in the root of the `lighthouse` repo.
#![cfg(test)]
use environment::{Environment, EnvironmentBuilder};
use eth1::{Eth1Endpoint, DEFAULT_CHAIN_ID};
Expand Down
5 changes: 1 addition & 4 deletions lcli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,14 @@ ethereum_hashing = { workspace = true }
ethereum_ssz = { workspace = true }
environment = { workspace = true }
eth2_network_config = { workspace = true }
genesis = { workspace = true }
deposit_contract = { workspace = true }
tree_hash = { workspace = true }
clap_utils = { workspace = true }
lighthouse_network = { workspace = true }
validator_dir = { workspace = true, features = ["insecure_keys"] }
validator_dir = { workspace = true }
lighthouse_version = { workspace = true }
account_utils = { workspace = true }
eth2_wallet = { workspace = true }
eth1_test_rig = { workspace = true }
sensitive_url = { workspace = true }
eth2 = { workspace = true }
snap = { workspace = true }
beacon_chain = { workspace = true }
Expand Down
45 changes: 0 additions & 45 deletions lcli/src/change_genesis_time.rs

This file was deleted.

Loading
Loading