From 649d699b13e3c2d7fcfb15e6e07c4fc4bdc90200 Mon Sep 17 00:00:00 2001 From: Jimmy Chen Date: Fri, 31 May 2024 13:54:13 +1000 Subject: [PATCH] Add missing download image step and remove unused `lcli` dependencies. --- .github/workflows/local-testnet.yml | 18 ++++++++++++++++++ Cargo.lock | 3 --- lcli/Cargo.toml | 5 +---- scripts/tests/doppelganger_protection.sh | 16 +++++++--------- 4 files changed, 26 insertions(+), 16 deletions(-) diff --git a/.github/workflows/local-testnet.yml b/.github/workflows/local-testnet.yml index 24206b67f67..34bc1bf024f 100644 --- a/.github/workflows/local-testnet.yml +++ b/.github/workflows/local-testnet.yml @@ -45,6 +45,15 @@ jobs: 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: Start local testnet run: ./start_local_testnet.sh -e local -c -b false && sleep 60 working-directory: scripts/local_testnet @@ -84,6 +93,15 @@ jobs: 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 diff --git a/Cargo.lock b/Cargo.lock index 22ed5178715..eb1ef078798 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4327,21 +4327,18 @@ dependencies = [ "deposit_contract", "env_logger 0.9.3", "environment", - "eth1_test_rig", "eth2", "eth2_network_config", "eth2_wallet", "ethereum_hashing", "ethereum_ssz", "execution_layer", - "genesis", "hex", "lighthouse_network", "lighthouse_version", "log", "malloc_utils", "rayon", - "sensitive_url", "serde", "serde_json", "serde_yaml", diff --git a/lcli/Cargo.toml b/lcli/Cargo.toml index 5d948a25c36..be369364da8 100644 --- a/lcli/Cargo.toml +++ b/lcli/Cargo.toml @@ -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 } diff --git a/scripts/tests/doppelganger_protection.sh b/scripts/tests/doppelganger_protection.sh index c7ef3da439d..5b9770b5c1c 100755 --- a/scripts/tests/doppelganger_protection.sh +++ b/scripts/tests/doppelganger_protection.sh @@ -2,7 +2,7 @@ # Requires `docker`, `kurtosis`, `yq`, `curl`, `jq` -set -Eeuo pipefail +set -Eeu SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" NETWORK_PARAMS_FILE=$SCRIPT_DIR/network_params.yaml @@ -43,7 +43,7 @@ function exit_and_dump_logs() { # Start local testnet $SCRIPT_DIR/../local_testnet/start_local_testnet.sh -e $ENCLAVE_NAME -b false -c -n $NETWORK_PARAMS_FILE -# Immediately stop node 4 +# Immediately stop node 4 (as we only need the node 4 validator keys generated for later use) kurtosis service stop $ENCLAVE_NAME cl-4-lighthouse-geth el-4-geth-lighthouse vc-4-geth-lighthouse echo "Waiting an epoch before starting the next validator client" @@ -123,7 +123,7 @@ if [[ "$BEHAVIOR" == "success" ]]; then # Get BN2 localhost URL bn2_2_local_url=$(kurtosis enclave inspect $ENCLAVE_NAME | grep 'cl-2-lighthouse-geth' | grep -oP 'http://[^ ]+') - echo "Performing checks using BN: $bn2_2_local_url" + echo "Performing checks using beacon node 2: $bn2_2_local_url" # Get VC4 validator keys keys_path=$SCRIPT_DIR/$ENCLAVE_NAME/node_4/validators @@ -133,9 +133,8 @@ if [[ "$BEHAVIOR" == "success" ]]; then for val in 0x*; do [[ -e $val ]] || continue - resp=$(curl -s $bn2_2_local_url/lighthouse/validator_inclusion/3/$val) - # TODO: error handling - is_attester=$(echo $resp | jq | grep -q '"is_previous_epoch_target_attester": false') + curl -s $bn2_2_local_url/lighthouse/validator_inclusion/3/$val | jq | grep -q '"is_previous_epoch_target_attester": false' + is_attester=$? if [[ $is_attester -eq 0 ]]; then echo "$val did not attest in epoch 2." else @@ -152,9 +151,8 @@ if [[ "$BEHAVIOR" == "success" ]]; then sleep $(( $SECONDS_PER_SLOT * 32 * 2 )) for val in 0x*; do [[ -e $val ]] || continue - resp=$(curl -s $bn2_2_host_url/lighthouse/validator_inclusion/5/$val) - # TODO: error handling - is_attester=$(echo $resp | jq | grep -q '"is_previous_epoch_target_attester": true') + curl -s $bn2_2_host_url/lighthouse/validator_inclusion/5/$val | jq | grep -q '"is_previous_epoch_target_attester": true' + is_attester=$? if [[ $is_attester -eq 0 ]]; then echo "$val attested in epoch 4." else