From 091a1072501509e5a2360bf448908e3ccedaaf66 Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Fri, 7 Jun 2024 12:01:45 +1000 Subject: [PATCH 01/26] Add cannon smoke test --- .github/workflows/cannon-smoke-test.yaml | 169 +++++++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 .github/workflows/cannon-smoke-test.yaml diff --git a/.github/workflows/cannon-smoke-test.yaml b/.github/workflows/cannon-smoke-test.yaml new file mode 100644 index 00000000..c895f83d --- /dev/null +++ b/.github/workflows/cannon-smoke-test.yaml @@ -0,0 +1,169 @@ +name: Sentry Smoke Test + +on: + pull_request: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +jobs: + cannon-smoke-test: + timeout-minutes: 20 + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Build xatu image + run: | + docker build -t ethpandaops/xatu:local . + echo "Xatu image is built." + - name: Run Xatu stack + timeout-minutes: 10 + shell: bash + run: | + docker compose up --build --detach --quiet-pull & + - name: Create Xatu Cannon config + run: | + cat < /tmp/cannon_config.yaml + name: cannon-smoke-test + + labels: + ethpandaops: rocks + + derivers: + attesterSlashing: + enabled: true + blsToExecutionChange: + enabled: true + deposit: + enabled: true + withdrawal: + enabled: true + executionTransaction: + enabled: true + proposerSlashing: + enabled: true + voluntaryExit: + enabled: true + beaconBlock: + enabled: true + beaconBlobSidecar: + enabled: true + proposerDuty: + enabled: true + + ntpServer: time.google.com + + ethereum: + beaconNodeAddress: https://lighthouse.sepolia.ethpandaops.io + beaconNodeHeaders: + CF-Access-Client-Id: {{ secrets.SEPOLIA_CF_ACCESS_CLIENT_ID }} + CF-Access-Client-Secret: {{ secrets.SEPOLIA_CF_ACCESS_CLIENT_SECRET }} + coordinator: + address: xatu-server:8080 + + outputs: + - name: log + type: stdout + - name: xatu + type: xatu + config: + address: xatu-server:8080 + tls: false + maxQueueSize: 51200 + batchTimeout: 5s + exportTimeout: 30s + maxExportBatchSize: 512 + EOF + - name: Start Xatu cannon + run: | + docker run -d --network --name xatu-cannon -v /tmp/cannon_config.yaml:/etc/xatu/config.yaml ethpandaops/xatu:local cannon --config /etc/xatu/config.yaml + - name: Verify Clickhouse has data from all sentries + timeout-minutes: 10 + run: | + echo "Checking Clickhouse for data from all sentries" + + tables=( + "canonical_beacon_block" + "canonical_beacon_block_execution_transaction" + ) + + # Define a function that prints the last 5 logs from all docker containers that have the argument in the name + pretty_print() { + local message=$1 + local color=$2 + local no_color='\033[0m' + local green='\033[0;32m' + local red='\033[0;31m' + local bright_red='\033[1;31m' + + # Choose color based on the type of message + if [ "$color" == "green" ]; then + color=$green + elif [ "$color" == "red" ]; then + color=$red + elif [ "$color" == "bright_red" ]; then + color=$bright_red + else + color=$no_color + fi + + echo -e "${color}######################${no_color}" + echo -e "${color} $message ${no_color}" + echo -e "${color}######################${no_color}" + } + + print_logs() { + for container in $(docker ps --filter name=$1 --format "{{.Names}}"); do + echo "Logs for $container:\n\n" + docker logs --tail 5 $container + done + } + + # Check for any data in the tables before digging in to the individual sentries + for table in "${tables[@]}"; do + pretty_print "Checking $table table..." "none" + data_count=$(docker exec xatu-clickhouse-01 clickhouse-client --query "SELECT COUNT(*) FROM default.$table" || true) + if [[ $data_count -gt 0 ]]; then + pretty_print "$table table has $data_count entries" "green" + else + pretty_print "$table table has no entries." "bright_red" + + print_logs xatu-server + print_logs vector + print_logs xatu-cannon + fi + done + + for table in "${tables[@]}"; do + pretty_print "Checking $table table..." "none" + while true; do + data_count=$(docker exec xatu-clickhouse-01 clickhouse-client --query "SELECT COUNT(*) FROM default.$table" || true) + if [[ $data_count -gt 0 ]]; then + pretty_print "$table has $data_count entries" "green" + break + else + pretty_print "$table has no entries." "bright_red" + + print_logs xatu-cannon + + sleep 5 + fi + done + done + + - name: Collect docker logs on failure + if: failure() + uses: jwalton/gh-docker-logs@v2 + with: + dest: './logs' + - name: Tar logs + if: failure() + run: tar cvzf ./logs.tgz ./logs + - name: Upload logs to GitHub + if: failure() + uses: actions/upload-artifact@master + with: + name: logs.tgz + path: ./logs.tgz \ No newline at end of file From 07b48c80126148f7f7177037ae8568eb10c44f93 Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Fri, 7 Jun 2024 12:02:24 +1000 Subject: [PATCH 02/26] Add cannon smoke test --- .github/workflows/cannon-smoke-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cannon-smoke-test.yaml b/.github/workflows/cannon-smoke-test.yaml index c895f83d..8ad460b4 100644 --- a/.github/workflows/cannon-smoke-test.yaml +++ b/.github/workflows/cannon-smoke-test.yaml @@ -1,4 +1,4 @@ -name: Sentry Smoke Test +name: Cannon Smoke Test on: pull_request: From cbd501b3d15b6d1c0f3d3d70ddff6668221d90f5 Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Fri, 7 Jun 2024 12:05:59 +1000 Subject: [PATCH 03/26] Add cannon smoke test --- .github/workflows/cannon-smoke-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cannon-smoke-test.yaml b/.github/workflows/cannon-smoke-test.yaml index 8ad460b4..b6c5fcd1 100644 --- a/.github/workflows/cannon-smoke-test.yaml +++ b/.github/workflows/cannon-smoke-test.yaml @@ -78,7 +78,7 @@ jobs: EOF - name: Start Xatu cannon run: | - docker run -d --network --name xatu-cannon -v /tmp/cannon_config.yaml:/etc/xatu/config.yaml ethpandaops/xatu:local cannon --config /etc/xatu/config.yaml + docker run -d --network xatu-net --name xatu-cannon -v /tmp/cannon_config.yaml:/etc/xatu/config.yaml ethpandaops/xatu:local cannon --config /etc/xatu/config.yaml - name: Verify Clickhouse has data from all sentries timeout-minutes: 10 run: | From d8a8b789790be459c58618c511dd417cc1c6c328 Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Fri, 7 Jun 2024 12:07:38 +1000 Subject: [PATCH 04/26] Add cannon smoke test --- .github/workflows/cannon-smoke-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cannon-smoke-test.yaml b/.github/workflows/cannon-smoke-test.yaml index b6c5fcd1..b457ae0d 100644 --- a/.github/workflows/cannon-smoke-test.yaml +++ b/.github/workflows/cannon-smoke-test.yaml @@ -22,7 +22,7 @@ jobs: timeout-minutes: 10 shell: bash run: | - docker compose up --build --detach --quiet-pull & + docker compose up --build --detach --quiet-pull - name: Create Xatu Cannon config run: | cat < /tmp/cannon_config.yaml From 09fd3c5c0957b32a016eea5a27b1f692f11143fa Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Fri, 7 Jun 2024 12:15:28 +1000 Subject: [PATCH 05/26] fix: Update network name in docker run command --- .github/workflows/cannon-smoke-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cannon-smoke-test.yaml b/.github/workflows/cannon-smoke-test.yaml index b457ae0d..870a5870 100644 --- a/.github/workflows/cannon-smoke-test.yaml +++ b/.github/workflows/cannon-smoke-test.yaml @@ -78,7 +78,7 @@ jobs: EOF - name: Start Xatu cannon run: | - docker run -d --network xatu-net --name xatu-cannon -v /tmp/cannon_config.yaml:/etc/xatu/config.yaml ethpandaops/xatu:local cannon --config /etc/xatu/config.yaml + docker run -d --network xatu_xatu-net --name xatu-cannon -v /tmp/cannon_config.yaml:/etc/xatu/config.yaml ethpandaops/xatu:local cannon --config /etc/xatu/config.yaml - name: Verify Clickhouse has data from all sentries timeout-minutes: 10 run: | From 410aedcfc56a5c714b98b11b855ab2895ba6c3fb Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Fri, 7 Jun 2024 12:25:49 +1000 Subject: [PATCH 06/26] Add cannon smoke test --- .github/workflows/cannon-smoke-test.yaml | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/.github/workflows/cannon-smoke-test.yaml b/.github/workflows/cannon-smoke-test.yaml index 870a5870..168c50fc 100644 --- a/.github/workflows/cannon-smoke-test.yaml +++ b/.github/workflows/cannon-smoke-test.yaml @@ -79,10 +79,10 @@ jobs: - name: Start Xatu cannon run: | docker run -d --network xatu_xatu-net --name xatu-cannon -v /tmp/cannon_config.yaml:/etc/xatu/config.yaml ethpandaops/xatu:local cannon --config /etc/xatu/config.yaml - - name: Verify Clickhouse has data from all sentries + - name: Verify Clickhouse has data timeout-minutes: 10 run: | - echo "Checking Clickhouse for data from all sentries" + echo "Checking Clickhouse for data" tables=( "canonical_beacon_block" @@ -130,29 +130,11 @@ jobs: else pretty_print "$table table has no entries." "bright_red" - print_logs xatu-server - print_logs vector + print_logs xatu-xatu-server print_logs xatu-cannon fi done - for table in "${tables[@]}"; do - pretty_print "Checking $table table..." "none" - while true; do - data_count=$(docker exec xatu-clickhouse-01 clickhouse-client --query "SELECT COUNT(*) FROM default.$table" || true) - if [[ $data_count -gt 0 ]]; then - pretty_print "$table has $data_count entries" "green" - break - else - pretty_print "$table has no entries." "bright_red" - - print_logs xatu-cannon - - sleep 5 - fi - done - done - - name: Collect docker logs on failure if: failure() uses: jwalton/gh-docker-logs@v2 From 43512c8c8787c6a48a665d127ff6f25145981724 Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Fri, 7 Jun 2024 12:33:30 +1000 Subject: [PATCH 07/26] Add cannon smoke test --- .github/workflows/cannon-smoke-test.yaml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/cannon-smoke-test.yaml b/.github/workflows/cannon-smoke-test.yaml index 168c50fc..6b77c1f0 100644 --- a/.github/workflows/cannon-smoke-test.yaml +++ b/.github/workflows/cannon-smoke-test.yaml @@ -123,16 +123,20 @@ jobs: # Check for any data in the tables before digging in to the individual sentries for table in "${tables[@]}"; do - pretty_print "Checking $table table..." "none" - data_count=$(docker exec xatu-clickhouse-01 clickhouse-client --query "SELECT COUNT(*) FROM default.$table" || true) - if [[ $data_count -gt 0 ]]; then - pretty_print "$table table has $data_count entries" "green" - else - pretty_print "$table table has no entries." "bright_red" + while true; do + pretty_print "Checking $table table..." "none" + data_count=$(docker exec xatu-clickhouse-01 clickhouse-client --query "SELECT COUNT(*) FROM default.$table" || true) + if [[ $data_count -gt 0 ]]; then + pretty_print "$table table has $data_count entries" "green" + break + else + pretty_print "$table table has no entries." "bright_red" - print_logs xatu-xatu-server - print_logs xatu-cannon - fi + print_logs xatu-xatu-server + print_logs xatu-cannon + sleep 1 + fi + done done - name: Collect docker logs on failure From 4c12054ef3ba58c14c7619b569382125da1d7a94 Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Fri, 7 Jun 2024 12:42:14 +1000 Subject: [PATCH 08/26] Add cannon smoke test --- .github/workflows/cannon-smoke-test.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cannon-smoke-test.yaml b/.github/workflows/cannon-smoke-test.yaml index 6b77c1f0..d41ef28c 100644 --- a/.github/workflows/cannon-smoke-test.yaml +++ b/.github/workflows/cannon-smoke-test.yaml @@ -131,6 +131,7 @@ jobs: break else pretty_print "$table table has no entries." "bright_red" + docker ps -a print_logs xatu-xatu-server print_logs xatu-cannon From 7c6e48d783d08f788f2fc9d3d6aeec1084d8e72e Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Fri, 7 Jun 2024 12:50:17 +1000 Subject: [PATCH 09/26] Add cannon smoke test --- .github/workflows/cannon-smoke-test.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cannon-smoke-test.yaml b/.github/workflows/cannon-smoke-test.yaml index d41ef28c..72f8237f 100644 --- a/.github/workflows/cannon-smoke-test.yaml +++ b/.github/workflows/cannon-smoke-test.yaml @@ -114,11 +114,9 @@ jobs: echo -e "${color}######################${no_color}" } - print_logs() { - for container in $(docker ps --filter name=$1 --format "{{.Names}}"); do - echo "Logs for $container:\n\n" - docker logs --tail 5 $container - done + print_logs() {] + echo "Logs for $container:\n\n" + docker logs --tail 5 $container } # Check for any data in the tables before digging in to the individual sentries From 5a5a618f44cf9d428246c8c36dbd2b5229e73231 Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Fri, 2 Aug 2024 15:35:42 +1000 Subject: [PATCH 10/26] feat: Add Xatu Cannon config with specified nodes --- .github/workflows/cannon-smoke-test.yaml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cannon-smoke-test.yaml b/.github/workflows/cannon-smoke-test.yaml index 72f8237f..7017aa0e 100644 --- a/.github/workflows/cannon-smoke-test.yaml +++ b/.github/workflows/cannon-smoke-test.yaml @@ -25,6 +25,16 @@ jobs: docker compose up --build --detach --quiet-pull - name: Create Xatu Cannon config run: | + declare -A nodes + nodes["holesky"]=( + "https://bn-holesky-nimbus-besu-001.utility.production.platform.ethpandaops.io" + ) + nodes["mainnet"]=( + "https://bn-mainnet-nimbus-besu-001.utility.production.platform.ethpandaops.io" + ) + nodes["sepolia"]=( + "https://bn-sepolia-nimbus-besu-001.utility.production.platform.ethpandaops.io" + ) cat < /tmp/cannon_config.yaml name: cannon-smoke-test @@ -56,10 +66,9 @@ jobs: ntpServer: time.google.com ethereum: - beaconNodeAddress: https://lighthouse.sepolia.ethpandaops.io + beaconNodeAddress: ${nodes[holesky]} beaconNodeHeaders: - CF-Access-Client-Id: {{ secrets.SEPOLIA_CF_ACCESS_CLIENT_ID }} - CF-Access-Client-Secret: {{ secrets.SEPOLIA_CF_ACCESS_CLIENT_SECRET }} + Authorization: "{{ secrets.PLATFORM_UTILITY_NODE_AUTHORIZATION }}" coordinator: address: xatu-server:8080 @@ -114,7 +123,7 @@ jobs: echo -e "${color}######################${no_color}" } - print_logs() {] + print_logs() { echo "Logs for $container:\n\n" docker logs --tail 5 $container } From 6ef75e2b9fb21dc6c241df2075bd54b5f88739d5 Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Fri, 2 Aug 2024 15:41:41 +1000 Subject: [PATCH 11/26] docs: Update network_params key name in YAML file --- .github/workflows/cannon-smoke-test.yaml | 7 +++++-- .github/workflows/sentry-smoke-test.yaml | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cannon-smoke-test.yaml b/.github/workflows/cannon-smoke-test.yaml index 7017aa0e..2b4ccb19 100644 --- a/.github/workflows/cannon-smoke-test.yaml +++ b/.github/workflows/cannon-smoke-test.yaml @@ -14,6 +14,9 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 + - name: Pull docker compose images in the background + run: | + docker compose pull & - name: Build xatu image run: | docker build -t ethpandaops/xatu:local . @@ -66,7 +69,7 @@ jobs: ntpServer: time.google.com ethereum: - beaconNodeAddress: ${nodes[holesky]} + beaconNodeAddress: ${nodes["holesky"]} beaconNodeHeaders: Authorization: "{{ secrets.PLATFORM_UTILITY_NODE_AUTHORIZATION }}" coordinator: @@ -81,7 +84,7 @@ jobs: address: xatu-server:8080 tls: false maxQueueSize: 51200 - batchTimeout: 5s + batchTimeout: 1s exportTimeout: 30s maxExportBatchSize: 512 EOF diff --git a/.github/workflows/sentry-smoke-test.yaml b/.github/workflows/sentry-smoke-test.yaml index 2d1a4a94..e8bbf7ba 100644 --- a/.github/workflows/sentry-smoke-test.yaml +++ b/.github/workflows/sentry-smoke-test.yaml @@ -35,7 +35,7 @@ jobs: - el_type: ethereumjs cl_type: nimbus additional_services: [] - network_parans: + network_params: genesis_delay: 180 xatu_sentry_enabled: true xatu_sentry_params: From 5a68dc20c344f2c99f5f6eec24e93dd22902cae3 Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Fri, 2 Aug 2024 15:49:22 +1000 Subject: [PATCH 12/26] style: Remove unnecessary code for Xatu Cannon config --- .github/workflows/cannon-smoke-test.yaml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/cannon-smoke-test.yaml b/.github/workflows/cannon-smoke-test.yaml index 2b4ccb19..5bd63636 100644 --- a/.github/workflows/cannon-smoke-test.yaml +++ b/.github/workflows/cannon-smoke-test.yaml @@ -28,16 +28,6 @@ jobs: docker compose up --build --detach --quiet-pull - name: Create Xatu Cannon config run: | - declare -A nodes - nodes["holesky"]=( - "https://bn-holesky-nimbus-besu-001.utility.production.platform.ethpandaops.io" - ) - nodes["mainnet"]=( - "https://bn-mainnet-nimbus-besu-001.utility.production.platform.ethpandaops.io" - ) - nodes["sepolia"]=( - "https://bn-sepolia-nimbus-besu-001.utility.production.platform.ethpandaops.io" - ) cat < /tmp/cannon_config.yaml name: cannon-smoke-test @@ -69,7 +59,7 @@ jobs: ntpServer: time.google.com ethereum: - beaconNodeAddress: ${nodes["holesky"]} + beaconNodeAddress: "https://bn-holesky-nimbus-besu-001.utility.production.platform.ethpandaops.io" beaconNodeHeaders: Authorization: "{{ secrets.PLATFORM_UTILITY_NODE_AUTHORIZATION }}" coordinator: From 49719653e5320c9696bd93ba44ae86551a75a5e9 Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Fri, 2 Aug 2024 16:03:21 +1000 Subject: [PATCH 13/26] feat: Add Cannon database seeding configuration --- .github/cannon/seeding.yaml | 20 ++++++++++++++++++++ .github/workflows/cannon-smoke-test.yaml | 4 ++++ 2 files changed, 24 insertions(+) create mode 100644 .github/cannon/seeding.yaml diff --git a/.github/cannon/seeding.yaml b/.github/cannon/seeding.yaml new file mode 100644 index 00000000..50045457 --- /dev/null +++ b/.github/cannon/seeding.yaml @@ -0,0 +1,20 @@ +# Cannon database seeding configuration for skipping types per network to epochs with known data. +# Useful for CI for events that are very rare, e.g. Proposer Slashingings. +# +# Note: Due to the way cannon progresses, we need to offset these epochs by 1. +# FinalizedEpoch will be processed until it is up to head ascendingly. +# Therefore, if we have data in epoch 100 for a specific type we +# should set the finalizedEpoch to 99. +networks: + - id: 17000 # Holesky + types: + - name: BEACON_API_ETH_V2_BEACON_BLOCK_DEPOSIT + finalizedEpoch: 69410 + - name: BEACON_API_ETH_V2_BEACON_BLOCK_BLS_TO_EXECUTION_CHANGE + finalizedEpoch: 69022 + - name: BEACON_API_ETH_V2_BEACON_BLOCK_ATTESTER_SLASHING + finalizedEpoch: 69463 + - name: BEACON_API_ETH_V2_BEACON_BLOCK_PROPOSER_SLASHING + finalizedEpoch: 69463 + - name: BEACON_API_ETH_V2_BEACON_BLOCK_VOLUNTARY_EXIT + finalizedEpoch: 69449 diff --git a/.github/workflows/cannon-smoke-test.yaml b/.github/workflows/cannon-smoke-test.yaml index 5bd63636..53a4b008 100644 --- a/.github/workflows/cannon-smoke-test.yaml +++ b/.github/workflows/cannon-smoke-test.yaml @@ -81,6 +81,10 @@ jobs: - name: Start Xatu cannon run: | docker run -d --network xatu_xatu-net --name xatu-cannon -v /tmp/cannon_config.yaml:/etc/xatu/config.yaml ethpandaops/xatu:local cannon --config /etc/xatu/config.yaml + - name: Wait for Xatu cannon to start + run: | + sleep 5 + docker logs xatu-cannon - name: Verify Clickhouse has data timeout-minutes: 10 run: | From af429f17e2bfe8ca6d050515b97bf0d79532ae7d Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Fri, 2 Aug 2024 16:13:50 +1000 Subject: [PATCH 14/26] feat: Add script to generate seed commands from YAML file --- .github/cannon/create-seed-commands.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 .github/cannon/create-seed-commands.sh diff --git a/.github/cannon/create-seed-commands.sh b/.github/cannon/create-seed-commands.sh new file mode 100755 index 00000000..7368b491 --- /dev/null +++ b/.github/cannon/create-seed-commands.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# Read the seeding.yaml file +yaml_content=$(cat ./seeding.yaml) + +while IFS= read -r line; do + if [[ $line =~ ^[[:space:]]*-[[:space:]]*id:[[:space:]]*([0-9]+) ]]; then + network_id="${BASH_REMATCH[1]}" + elif [[ $line =~ ^[[:space:]]*-[[:space:]]*name:[[:space:]]*(.+) ]]; then + type="${BASH_REMATCH[1]}" + elif [[ $line =~ ^[[:space:]]*finalizedEpoch:[[:space:]]*([0-9]+) ]]; then + epoch="${BASH_REMATCH[1]}" + value="{\"backfillingCheckpointMarker\":{\"finalizedEpoch\":\"$epoch\"}}" + echo "INSERT INTO cannon_location (network_id, type, value)" + echo "VALUES ('$network_id', '$type', '$value')" + echo "ON CONFLICT (network_id, type) DO UPDATE" + echo "SET value = EXCLUDED.value, update_time = now();" + echo + fi +done <<< "$yaml_content" From 48d574c0d274e497e1f5806468afeba2c1789533 Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Fri, 2 Aug 2024 16:14:00 +1000 Subject: [PATCH 15/26] feat: Seed Postgres with cannon data --- .github/workflows/cannon-smoke-test.yaml | 31 ++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.github/workflows/cannon-smoke-test.yaml b/.github/workflows/cannon-smoke-test.yaml index 53a4b008..5af681fd 100644 --- a/.github/workflows/cannon-smoke-test.yaml +++ b/.github/workflows/cannon-smoke-test.yaml @@ -26,6 +26,37 @@ jobs: shell: bash run: | docker compose up --build --detach --quiet-pull + - name: Seed Postgres with cannon data + run: | + # Wait for Postgres to be ready + echo "Waiting for Postgres to be ready..." + docker exec xatu-postgres sh -c 'while ! pg_isready; do sleep 1; done' + echo "Postgres is ready." + + # Wait for the cannon_location table to be created + echo "Waiting for cannon_location table to be created..." + until docker exec xatu-postgres psql -U user -d xatu -c "SELECT 1 FROM cannon_location LIMIT 1" &> /dev/null + do + echo "Table not ready yet. Waiting 5 seconds..." + sleep 5 + done + + echo "cannon_location table is now available." + # Generate seeding commands + echo "Generating seeding commands..." + SEEDING_COMMANDS=$(bash .github/cannon/create-seed-commands.sh) + + echo "Seeding data prepared." + + # Execute each seeding command individually + echo "$SEEDING_COMMANDS" | while read -r command; do + if [ -n "$command" ]; then + echo "Executing command: $command" + docker exec xatu-postgres psql -U user -d xatu -c "$command" + fi + done + + echo "Seeding completed successfully." - name: Create Xatu Cannon config run: | cat < /tmp/cannon_config.yaml From 76fc8f4812f60d86b759ed18861a96573db84a7b Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Fri, 2 Aug 2024 16:19:59 +1000 Subject: [PATCH 16/26] fix: Update script to accept seeding.yaml location argument --- .github/cannon/create-seed-commands.sh | 10 ++++++++-- .github/workflows/cannon-smoke-test.yaml | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/cannon/create-seed-commands.sh b/.github/cannon/create-seed-commands.sh index 7368b491..4c0043b3 100755 --- a/.github/cannon/create-seed-commands.sh +++ b/.github/cannon/create-seed-commands.sh @@ -1,7 +1,13 @@ #!/bin/bash -# Read the seeding.yaml file -yaml_content=$(cat ./seeding.yaml) +# Check if the location argument is provided +if [ $# -eq 0 ]; then + echo "Error: Please provide the location of seeding.yaml as an argument." + exit 1 +fi + +# Read the seeding.yaml file from the provided location +yaml_content=$(cat "$1") while IFS= read -r line; do if [[ $line =~ ^[[:space:]]*-[[:space:]]*id:[[:space:]]*([0-9]+) ]]; then diff --git a/.github/workflows/cannon-smoke-test.yaml b/.github/workflows/cannon-smoke-test.yaml index 5af681fd..ff7382c1 100644 --- a/.github/workflows/cannon-smoke-test.yaml +++ b/.github/workflows/cannon-smoke-test.yaml @@ -28,6 +28,7 @@ jobs: docker compose up --build --detach --quiet-pull - name: Seed Postgres with cannon data run: | + set -e; # Wait for Postgres to be ready echo "Waiting for Postgres to be ready..." docker exec xatu-postgres sh -c 'while ! pg_isready; do sleep 1; done' @@ -44,7 +45,7 @@ jobs: echo "cannon_location table is now available." # Generate seeding commands echo "Generating seeding commands..." - SEEDING_COMMANDS=$(bash .github/cannon/create-seed-commands.sh) + SEEDING_COMMANDS=$(bash .github/cannon/create-seed-commands.sh .github/cannon/seeding.yaml) echo "Seeding data prepared." From e1a4babfa48371b7824f303626e53cdae7e5eb5a Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Fri, 2 Aug 2024 16:30:29 +1000 Subject: [PATCH 17/26] feat: Add command to show database state --- .github/workflows/cannon-smoke-test.yaml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cannon-smoke-test.yaml b/.github/workflows/cannon-smoke-test.yaml index ff7382c1..dd3cd576 100644 --- a/.github/workflows/cannon-smoke-test.yaml +++ b/.github/workflows/cannon-smoke-test.yaml @@ -48,16 +48,15 @@ jobs: SEEDING_COMMANDS=$(bash .github/cannon/create-seed-commands.sh .github/cannon/seeding.yaml) echo "Seeding data prepared." + + echo "SEEDING_COMMANDS: $SEEDING_COMMANDS" - # Execute each seeding command individually - echo "$SEEDING_COMMANDS" | while read -r command; do - if [ -n "$command" ]; then - echo "Executing command: $command" - docker exec xatu-postgres psql -U user -d xatu -c "$command" - fi - done + docker exec xatu-postgres psql -U user -d xatu -c "$SEEDING_COMMANDS" echo "Seeding completed successfully." + - name: Show the state of the database + run: | + docker exec xatu-postgres psql -U user -d xatu -c "SELECT * FROM cannon_location;" - name: Create Xatu Cannon config run: | cat < /tmp/cannon_config.yaml @@ -87,6 +86,8 @@ jobs: enabled: true proposerDuty: enabled: true + beaconCommittee: + enabled: true ntpServer: time.google.com From 6a586ce45a45162e2d6cfe15f42ddae748c1110e Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Fri, 2 Aug 2024 16:51:58 +1000 Subject: [PATCH 18/26] chore: Update cannon-smoke-test.yaml config details --- .github/workflows/cannon-smoke-test.yaml | 102 ++++++++++++----------- 1 file changed, 52 insertions(+), 50 deletions(-) diff --git a/.github/workflows/cannon-smoke-test.yaml b/.github/workflows/cannon-smoke-test.yaml index dd3cd576..8e35dea3 100644 --- a/.github/workflows/cannon-smoke-test.yaml +++ b/.github/workflows/cannon-smoke-test.yaml @@ -60,57 +60,59 @@ jobs: - name: Create Xatu Cannon config run: | cat < /tmp/cannon_config.yaml - name: cannon-smoke-test - - labels: - ethpandaops: rocks - - derivers: - attesterSlashing: - enabled: true - blsToExecutionChange: - enabled: true - deposit: - enabled: true - withdrawal: - enabled: true - executionTransaction: - enabled: true - proposerSlashing: - enabled: true - voluntaryExit: - enabled: true - beaconBlock: - enabled: true - beaconBlobSidecar: - enabled: true - proposerDuty: - enabled: true - beaconCommittee: - enabled: true - - ntpServer: time.google.com - - ethereum: - beaconNodeAddress: "https://bn-holesky-nimbus-besu-001.utility.production.platform.ethpandaops.io" - beaconNodeHeaders: - Authorization: "{{ secrets.PLATFORM_UTILITY_NODE_AUTHORIZATION }}" - coordinator: - address: xatu-server:8080 - - outputs: - - name: log - type: stdout - - name: xatu - type: xatu - config: - address: xatu-server:8080 - tls: false - maxQueueSize: 51200 - batchTimeout: 1s - exportTimeout: 30s - maxExportBatchSize: 512 + name: cannon-smoke-test + labels: + ethpandaops: rocks + + derivers: + attesterSlashing: + enabled: true + blsToExecutionChange: + enabled: true + deposit: + enabled: true + withdrawal: + enabled: true + executionTransaction: + enabled: true + proposerSlashing: + enabled: true + voluntaryExit: + enabled: true + beaconBlock: + enabled: true + beaconBlobSidecar: + enabled: true + proposerDuty: + enabled: true + beaconCommittee: + enabled: true + + ntpServer: time.google.com + + ethereum: + beaconNodeAddress: "https://bn-holesky-nimbus-besu-001.utility.production.platform.ethpandaops.io" + beaconNodeHeaders: + Authorization: "AUTH_HEADER" + coordinator: + address: xatu-server:8080 + + outputs: + - name: log + type: stdout + - name: xatu + type: xatu + config: + address: xatu-server:8080 + tls: false + maxQueueSize: 51200 + batchTimeout: 1s + exportTimeout: 30s + maxExportBatchSize: 512 EOF + - name: Set authorization header + run: | + sed -i 's/AUTH_HEADER/${{ secrets.PLATFORM_UTILITY_NODE_AUTHORIZATION }}/' /tmp/cannon_config.yaml - name: Start Xatu cannon run: | docker run -d --network xatu_xatu-net --name xatu-cannon -v /tmp/cannon_config.yaml:/etc/xatu/config.yaml ethpandaops/xatu:local cannon --config /etc/xatu/config.yaml From 6ed000680ad4385bc0a4e6e03f2b167d08471fc7 Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Fri, 9 Aug 2024 12:27:39 +1000 Subject: [PATCH 19/26] test: Add assertions for different network types --- .github/cannon/assert_clickhouse.sh | 65 ++++++++++++++++++++ .github/cannon/seeding.yaml | 94 +++++++++++++++++++++++++++-- 2 files changed, 155 insertions(+), 4 deletions(-) create mode 100755 .github/cannon/assert_clickhouse.sh diff --git a/.github/cannon/assert_clickhouse.sh b/.github/cannon/assert_clickhouse.sh new file mode 100755 index 00000000..eefc0b6e --- /dev/null +++ b/.github/cannon/assert_clickhouse.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +# Check if seeding.yaml location is provided as a parameter +if [ $# -eq 0 ]; then + echo "Error: Please provide the location of seeding.yaml as an argument." + exit 1 +fi + +SEEDING_YAML="$1" + +# Set variables for ClickHouse connection +CLICKHOUSE_HOST=${CLICKHOUSE_HOST:-"localhost"} +CLICKHOUSE_PORT=${CLICKHOUSE_PORT:-"9000"} +CLICKHOUSE_USER=${CLICKHOUSE_USER:-"default"} +CLICKHOUSE_PASSWORD=${CLICKHOUSE_PASSWORD:-""} +CLICKHOUSE_DB=${CLICKHOUSE_DB:-"default"} + +# Function to execute ClickHouse query +execute_query() { + clickhouse client -h "$CLICKHOUSE_HOST" --port "$CLICKHOUSE_PORT" -u "$CLICKHOUSE_USER" --password "$CLICKHOUSE_PASSWORD" -d "$CLICKHOUSE_DB" -q "$1" +} + +# Check if the seeding.yaml file exists +if [ ! -f "$SEEDING_YAML" ]; then + echo "Error: seeding.yaml file not found at $SEEDING_YAML" + exit 1 +fi + +# Parse the YAML file and execute queries +yq e '.networks[].types[] | [.name, .assert.query, .assert.expected] | @tsv' "$SEEDING_YAML" | while IFS=$'\t' read -r name query expected; do + if [ -z "$query" ] || [ "$query" == "null" ]; then + echo "Query is empty. Skipping..." + continue + fi + + while true; do + echo "Asserting type: $name" + echo "Executing query: $query" + result=$(execute_query "$query") + + if [ -n "$result" ]; then + echo "Result: $result" + + # Evaluate the expected condition + if [ -n "$expected" ] && [ "$expected" != "null" ]; then + if [ "$result" -eq "$expected" ]; then + echo "Assertion passed for $name" + break + else + echo "Assertion failed for $name. Expected: $expected, Got: $result" + sleep 2 + continue + fi + else + echo "No assertion condition provided for $name. Continuing..." + break + fi + else + echo "No data found for $name. Retrying in 5 seconds..." + sleep 5 + fi + done +done + +echo "All assertions completed." \ No newline at end of file diff --git a/.github/cannon/seeding.yaml b/.github/cannon/seeding.yaml index 50045457..a0da33d1 100644 --- a/.github/cannon/seeding.yaml +++ b/.github/cannon/seeding.yaml @@ -1,5 +1,5 @@ # Cannon database seeding configuration for skipping types per network to epochs with known data. -# Useful for CI for events that are very rare, e.g. Proposer Slashingings. +# Useful for CI for events that are very rare, e.g. Proposer Slashing. # # Note: Due to the way cannon progresses, we need to offset these epochs by 1. # FinalizedEpoch will be processed until it is up to head ascendingly. @@ -10,11 +10,97 @@ networks: types: - name: BEACON_API_ETH_V2_BEACON_BLOCK_DEPOSIT finalizedEpoch: 69410 + assert: + query: "SELECT COUNT(*) + FROM canonical_beacon_block_deposit FINAL + WHERE epoch = 69411 AND + block_root = '0x50ae6c14a7868ce28455d1cdc170e6d993aae86396036f64f42607c5b259e0b2' AND + block_version = 'deneb' AND + deposit_data_pubkey = '0x96a54404be0164059556ea2447a8fefca5f04482b6e97b7fb1c0cc924171dcffb986c73e8991e47cd9693eee3c4e7cc4' AND + deposit_data_withdrawal_credentials = '0x01000000000000000000000027aabee07e0dbc8b0de20f42b1a1980871314ef5' AND + deposit_data_amount = 32000000000 AND + deposit_data_signature = '0xa9ac89d73f43b2f6eae61fc3217ba6ce1c9a3a9cfdcc11b498c8dcf3093aad108fbf50a259ef74b379e735cef7fb892402a7b07300177231c2f35de8ae9d5d3bb0f4158b2fc14528a91f4bcd542091a2188a9652c94e05a0a6e4fc991beda24d'; + " + expected: "1" - name: BEACON_API_ETH_V2_BEACON_BLOCK_BLS_TO_EXECUTION_CHANGE finalizedEpoch: 69022 + assert: + query: "SELECT COUNT(*) FROM canonical_beacon_block_bls_to_execution_change FINAL + WHERE + epoch = 69023 + AND slot = 2208761 + AND block_root = '0x88b969e23aaeb906eec59fad6f33be071f0e73870bbfa6f78163237c221ba84' + AND block_version = 'deneb' + AND exchanging_message_validator_index = 1754707 + AND exchanging_message_from_bls_pubkey = '0x8bc000fedf7df347e68fcf72ae74f0516cd6051fdb426853744cfee3ff4d171f63c574483acfd4c756c29ee4bcec8ea9' + AND exchanging_message_to_execution_address = '0x1c0A59Ecd75e0B2D5dc9788F028e7643AF1dc547' + AND exchanging_signature = '0x90c746541b567f7228623ba8991949098fef1f23b23d773c4c021b13989fad811f5fba2bad5ccd4f46e73d16b20066a6057603f0c7433c8075e17efb20380a0400e0dce6671ba6237a2807aeb218e77394c32053ea4c8475ad973f7214b34bdb' + " + expected: "1" - name: BEACON_API_ETH_V2_BEACON_BLOCK_ATTESTER_SLASHING - finalizedEpoch: 69463 + finalizedEpoch: 67271 + assert: + query: "SELECT COUNT(*) as cnt + FROM canonical_beacon_block_attester_slashing FINAL + WHERE + epoch = 67272 + AND block_root = '0xdba4fcca638f678a0576117f9709e77e889d816cca14e06a207c1945f0ed3447' + AND block_version = 'deneb' + AND has(attestation_1_attesting_indices, 1726414) + AND attestation_1_signature = '0xaadb1a17a200d4a8703ee2316969df1fa62959ebca53262d37134d245002b0be07927feb998aca280b5c250195af768c02ff9e1048d7e858cce39c264bcc0549fbcb1214f69e16b4c57ac54682635930793973f162b4f786442767a1c326d06e' + AND attestation_1_data_beacon_block_root = '0xcd45e27eb9855fb4195a82baa97f9fdce3b442d74c2ca9c5b8410347207c33e0' + AND attestation_1_data_slot = 2152725 + AND attestation_1_data_index = 46 + AND attestation_1_data_source_epoch = 67271 + AND attestation_1_data_source_root = '0x0dd676fb6fbed7362e55c0400367fb4d46cf8ae266b8270dada8d8f3b57054b8' + AND attestation_1_data_target_epoch = 67272 + AND attestation_1_data_target_root = '0x9737bb5720eaa73775300e4403cbeecffca9c202afacf6e92dfee6298c1180e0' + AND has(attestation_2_attesting_indices, 1726414) + AND attestation_2_signature = '0xae331ac2daac8f17fdcc57f29f5abc75b459456e3fe518d89c74ce126551a93914c7782e6e2df48b6baa57f01116104614d3fac6ec4bbf6a34fc8652aa433cd0f4ed0f7d598ae113668a6a71d240e4d56b843a5fbf9b192a6303fb9ef83e94e4' + AND attestation_2_data_beacon_block_root = '0x030b490805227553adabf9e7210422c705c0e30381aa647fb61efb3e23c407f4' + AND attestation_2_data_slot = 2152725 + AND attestation_2_data_index = 46 + AND attestation_2_data_source_epoch = 67271 + AND attestation_2_data_source_root = '0x0dd676fb6fbed7362e55c0400367fb4d46cf8ae266b8270dada8d8f3b57054b8' + AND attestation_2_data_target_epoch = 67272 + AND attestation_2_data_target_root = '0x9737bb5720eaa73775300e4403cbeecffca9c202afacf6e92dfee6298c1180e0' + " + expected: "1" - name: BEACON_API_ETH_V2_BEACON_BLOCK_PROPOSER_SLASHING - finalizedEpoch: 69463 + finalizedEpoch: 57600 + assert: + query: "SELECT COUNT(*) as cnt + FROM canonical_beacon_block_proposer_slashing FINAL + WHERE + epoch = 57601 + AND block_root = '0x3c42bf130d6c86c8e57829355b550a58ee0b0de1397e1a81a7ab8e17a7c829ab' + AND block_version = 'deneb' + AND signed_header_1_message_slot = 1843233 + AND signed_header_1_message_proposer_index = '356870' + AND signed_header_1_message_body_root = '0xc9544d722e81285b989c0de9d8eaab28001518ece10c0256ad62bc5478e52723' + AND signed_header_1_message_parent_root = '0xbd83d108fe8bf4f9d08bbf89b8ca3bbd103673b5efd7bfeae6155eae283903d8' + AND signed_header_1_message_state_root = '0xccc6dd1f9de4d215deca9f3f6c0c2a8b37756e26f9c935970119d8003fff8f4a' + AND signed_header_1_signature = '0x88cb94b1e76d1fc68d1941446d5c78d6e4516636499cb96be14ee0b5d740f38a32991ebbe52dd09404ede2fd18c828ea13ecc7f49f7bacc3845af1e10dfc7cc7403dfa479b90ef4356e4ff1c6e3f3fc8abee8b1cb098cbd64f64390cbaf2070a' + AND signed_header_2_message_slot = 1843233 + AND signed_header_2_message_proposer_index = 356870 + AND signed_header_2_message_body_root = '0x9f3d4ca2aefc1b3f161574a6705e13b928d64505e45ca16e87037f39b7dd9495' + AND signed_header_2_message_parent_root = '0xf8b753905c00f11b81a5ed0932b747f2fa991bc62e425d6e54cbc10ff6deda80' + AND signed_header_2_message_state_root = '0x17e721ab0fe80976d8d01365f83039d3eb8b840e8cd8cce2fe9e4d9ad9bd4bd9' + AND signed_header_2_signature = '0xa8d677fbe5eaf0a46d08e1f6bd23d071606321b82e1b9bb84c40792439c6b7630cf80f2a3d702ebf7a36c9338f702cb2147b47651b7871fbfb3cff3a301e0b99f6f23527aa8927d11231156e9addb4d15a01329f5a47ccf6219d067e5aef22e5' + " + expected: "1" - name: BEACON_API_ETH_V2_BEACON_BLOCK_VOLUNTARY_EXIT - finalizedEpoch: 69449 + finalizedEpoch: 70807 + assert: + query: " + SELECT COUNT(*) + FROM canonical_beacon_block_voluntary_exit FINAL + WHERE + epoch = 70808 AND + block_root = '0x682d244580d3838dd6757cbd5bec3f16fc235869589617dd0cacacb92b167f15' AND + block_version = 'deneb' AND + voluntary_exit_signature = '0xa72f5852964e265714eb8c9ff56542e4dd5c8c82f43f8ad5a33da5489dd7a620e15d831f0b4b728ace4af56adb0ff9050033a85a4cc386acac89be0651503a7043d544803c4d77559a1917645957f65308a7352ff1daaeaf6556f01bf149d4ba' AND + voluntary_exit_validator_exit = 1771272 AND + voluntary_exit_message_epoch = 70808 + " + expected: "1" \ No newline at end of file From 34fbee8d8728f2494e88cbc6d6050940119d115d Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Fri, 9 Aug 2024 14:33:23 +1000 Subject: [PATCH 20/26] test: Update cannon-smoke-test.yaml beaconNodeAddress --- .github/cannon/seeding.yaml | 163 +++++++++++++++++++++-- .github/workflows/cannon-smoke-test.yaml | 61 +-------- 2 files changed, 159 insertions(+), 65 deletions(-) diff --git a/.github/cannon/seeding.yaml b/.github/cannon/seeding.yaml index a0da33d1..b0a46aed 100644 --- a/.github/cannon/seeding.yaml +++ b/.github/cannon/seeding.yaml @@ -29,7 +29,7 @@ networks: WHERE epoch = 69023 AND slot = 2208761 - AND block_root = '0x88b969e23aaeb906eec59fad6f33be071f0e73870bbfa6f78163237c221ba84' + AND block_root = '0x88b969e23aaeb906eec59fad6f33be071f0e73870bbfa6f781632337c221ba84' AND block_version = 'deneb' AND exchanging_message_validator_index = 1754707 AND exchanging_message_from_bls_pubkey = '0x8bc000fedf7df347e68fcf72ae74f0516cd6051fdb426853744cfee3ff4d171f63c574483acfd4c756c29ee4bcec8ea9' @@ -92,15 +92,160 @@ networks: - name: BEACON_API_ETH_V2_BEACON_BLOCK_VOLUNTARY_EXIT finalizedEpoch: 70807 assert: - query: " - SELECT COUNT(*) + query: "SELECT COUNT(*) FROM canonical_beacon_block_voluntary_exit FINAL WHERE - epoch = 70808 AND - block_root = '0x682d244580d3838dd6757cbd5bec3f16fc235869589617dd0cacacb92b167f15' AND - block_version = 'deneb' AND - voluntary_exit_signature = '0xa72f5852964e265714eb8c9ff56542e4dd5c8c82f43f8ad5a33da5489dd7a620e15d831f0b4b728ace4af56adb0ff9050033a85a4cc386acac89be0651503a7043d544803c4d77559a1917645957f65308a7352ff1daaeaf6556f01bf149d4ba' AND - voluntary_exit_validator_exit = 1771272 AND - voluntary_exit_message_epoch = 70808 + epoch = 70808 + AND block_root = '0x682d244580d3838dd6757cbd5bec3f16fc235869589617dd0cacacb92b167f15' + AND block_version = 'deneb' + AND voluntary_exit_signature = '0xa72f5852964e265714eb8c9ff56542e4dd5c8c82f43f8ad5a33da5489dd7a620e15d831f0b4b728ace4af56adb0ff9050033a85a4cc386acac89be0651503a7043d544803c4d77559a1917645957f65308a7352ff1daaeaf6556f01bf149d4ba' + AND voluntary_exit_message_validator_index = 1771272 + AND voluntary_exit_message_epoch = 70808 + " + expected: "1" + - name: BEACON_API_ETH_V2_BEACON_BLOCK + finalizedEpoch: 71009 + assert: + query: "SELECT COUNT(*) FROM canonical_beacon_block FINAL + WHERE + slot = 2272320 + AND slot_start_date_time = '2024-08-09 02:24:00' + AND epoch = 71010 + AND epoch_start_date_time = '2024-08-09 02:24:00' + AND block_root = '0xff8e97fdf4033e499681ff0eb056cf5f2877a8f9b16f14e2db3956b75190b9e7' + AND block_version = 'deneb' + AND block_total_bytes = 204103 + AND block_total_bytes_compressed = 95454 + AND parent_root = '0x54264e13e97a137bed2cc1a52cf76a94bb5e385507d34ff3902d18672f4ef79e' + AND state_root = '0x3598ed522160cb6dd0aab216f03b26d61b32d87854c3d38754897017a66004f5' + AND proposer_index = 416934 + AND eth1_data_block_hash = '0xa80ebe78370b22214b15898701c10c9c49fc77809ac72548aba918e389a95f28' + AND eth1_data_deposit_root = '0x50bfebb571f79b3d094192b0187145cb2773a2d0a16968fad7a9ea054ce2fdb4' + AND execution_payload_block_hash = '0x1ba818c4f3509131eb0c513410b7de01632b8ca54042f8a48b5cda1e6ae7151b' + AND execution_payload_block_number = 2095983 + AND execution_payload_fee_recipient = '0x9baA3244565d51D9C7897c0EB6679eD4890e536E' + AND execution_payload_state_root = '0x86e8dcd6e429b1ead94b17eabbb5de3c42c19217ab57a16f7f6a857d078e2eff' + AND execution_payload_parent_hash = '0x8d8d8266b756c27205a15a38b914b971f12ec6c1759f5a5643697cf394068ad1' + AND execution_payload_transactions_count = 67 + AND execution_payload_transactions_total_bytes = 49669 + AND execution_payload_transactions_total_bytes_compressed = 27703" + expected: "1" + - name: BEACON_API_ETH_V1_PROPOSER_DUTY + finalizedEpoch: 71002 + assert: + query: "SELECT COUNT(*) FROM canonical_beacon_proposer_duty FINAL + WHERE + slot = 2272098 + AND slot_start_date_time = '2024-08-09 01:39:36' + AND epoch = 71003 + AND epoch_start_date_time = '2024-08-09 01:39:12' + AND proposer_validator_index = 1337851 + AND proposer_pubkey = '0xb69cc87f9610eeaff816b2c0182e3320fd04c8be572a3adba2b40d7f11a6d84dadeb24cf2829d10eda0d611b46da0907'" + expected: "1" + - name: BEACON_API_ETH_V1_BEACON_BLOB_SIDECAR + finalizedEpoch: 71010 + assert: + query: "SELECT COUNT(*) FROM canonical_beacon_blob_sidecar FINAL + WHERE + slot = 2272356 + AND slot_start_date_time = '2024-08-09 02:31:12' + AND epoch = 71011 + AND epoch_start_date_time = '2024-08-09 02:30:24' + AND block_root = '0x1e02ff0da1811c5609acafd4597543878cb6216fe519587da1ab0aeb3296ac75' + AND block_parent_root = '0x0e81a2325869e04919bffc5bbf745ecafd22c7005ac717ee5122f1a3f51ea24a' + AND versioned_hash = '0x0100d3b0b63aefd96e6b2c7aa84c1a0cdd6fe8366128cebf032fc64846c6608c' + AND kzg_commitment = '0xb1b3ca5607286f6b221fa38321a80980cfe10946e9e33e07b74e13a93e385ddb99ca727a1f617e6f0c088f68f1da63b5' + AND kzg_proof = '0x8bdca97a0c6c7baf0a94d25bfa70024319f2ebb36442865333f6d41d8d5f141283f337da24dc7f3b72151098ddf60571' + AND proposer_index = 1744957 + AND blob_index = 2 + AND blob_size = 131072 + AND blob_empty_size = 56206" + expected: "1" + - name: BEACON_API_ETH_V1_BEACON_VALIDATORS + finalizedEpoch: 71005 + assert: + query: "SELECT COUNT(*) FROM canonical_beacon_validators FINAL + WHERE + epoch = 71006 + AND epoch_start_date_time = '2024-08-09 01:58:24' + AND `index` = 0 + AND balance = '32005471610' + AND status = 'active_ongoing' + AND effective_balance = '32000000000' + AND slashed = false" + expected: "1" + - name: BEACON_API_ETH_V1_BEACON_VALIDATORS + finalizedEpoch: 71005 + assert: + query: "SELECT COUNT(*) FROM canonical_beacon_validators_pubkeys FINAL + WHERE + `index` = 0 + AND pubkey = '0x8c87f7a01e54215ac177fb706d78e9edf762f15f34ba81103094da450f1683ced257d4270fc030a9a803aaa060edf16a'" + expected: "1" + - name: BEACON_API_ETH_V1_BEACON_VALIDATORS + finalizedEpoch: 71005 + assert: + query: "SELECT COUNT(*) FROM canonical_beacon_validators_withdrawal_credentials FINAL + WHERE + `index` = 0 + AND withdrawal_credentials = '0x0100000000000000000000000e5dda855eb1de2a212cd1f62b2a3ee49d20c444'" + expected: "1" + - name: BEACON_API_ETH_V2_BEACON_BLOCK_EXECUTION_TRANSACTION + finalizedEpoch: 71010 + assert: + query: "SELECT COUNT(*) FROM canonical_beacon_block_execution_transaction FINAL + WHERE + slot = 2272352 + AND slot_start_date_time = '2024-08-09 02:30:24' + AND epoch = 71011 + AND epoch_start_date_time = '2024-08-09 02:30:24' + AND block_root = '0x92818da049f530f531878aead240dd43ca95b87fde0ee3bc65ae1f334a172457' + AND block_version = 'deneb' + AND position = 0 + AND hash = '0x50ba44917e11e686f74aa02874694e4c11216e789a8e98914e397d3cdd874a63' + AND `from` = '0xc227C08d62cBedF89B1B605Ef03868838E9ABf1e' + AND `to` = '0x39C2A9c40c6bd507563648b5175F9aF712808A69' + AND nonce = '1' + AND gas_price = '10000000000' + AND gas = '21000' + AND gas_tip_cap = '10000000000' + AND gas_fee_cap = '10000000000' + AND value = '3059301224999739320' + AND type = 0 + AND size = 112 + AND call_data_size = 0 + AND blob_gas IS NULL + AND blob_gas_fee_cap IS NULL + AND blob_hashes = [] + AND blob_sidecars_size = 0 + AND blob_sidecars_empty_size = 0" + expected: "1" + - name: BEACON_API_ETH_V2_BEACON_BLOCK_WITHDRAWAL + finalizedEpoch: 71010 + assert: + query: "SELECT COUNT(*) FROM canonical_beacon_block_withdrawal FINAL + WHERE + slot = 2272352 + AND slot_start_date_time = '2024-08-09 02:30:24' + AND epoch = 71011 + AND epoch_start_date_time = '2024-08-09 02:30:24' + AND block_root = '0x92818da049f530f531878aead240dd43ca95b87fde0ee3bc65ae1f334a172457' + AND block_version = 'deneb' + AND withdrawal_index = 33356747 + AND withdrawal_validator_index = 1501755 + AND withdrawal_address = '0x428614Fb30e3007e5d628D09e8BDB0CE9720FAdB' + AND withdrawal_amount = '7498159'" + expected: "1" + - name: BEACON_API_ETH_V1_BEACON_COMMITTEE + finalizedEpoch: 71016 + assert: + query: "SELECT COUNT(*) FROM canonical_beacon_committee FINAL + WHERE + slot = 2272557 + AND slot_start_date_time = '2024-08-09 03:11:24' + AND committee_index = '21' + AND epoch = 71017 + AND epoch_start_date_time = '2024-08-09 03:08:48' + AND has(validators, 1119923) " expected: "1" \ No newline at end of file diff --git a/.github/workflows/cannon-smoke-test.yaml b/.github/workflows/cannon-smoke-test.yaml index 8e35dea3..bb3ffb1a 100644 --- a/.github/workflows/cannon-smoke-test.yaml +++ b/.github/workflows/cannon-smoke-test.yaml @@ -91,7 +91,7 @@ jobs: ntpServer: time.google.com ethereum: - beaconNodeAddress: "https://bn-holesky-nimbus-besu-001.utility.production.platform.ethpandaops.io" + beaconNodeAddress: "https://bn-holesky-lighthouse-erigon-001.utility.production.platform.ethpandaops.io" beaconNodeHeaders: Authorization: "AUTH_HEADER" coordinator: @@ -110,6 +110,9 @@ jobs: exportTimeout: 30s maxExportBatchSize: 512 EOF + - name: Show config + run: | + cat /tmp/cannon_config.yaml - name: Set authorization header run: | sed -i 's/AUTH_HEADER/${{ secrets.PLATFORM_UTILITY_NODE_AUTHORIZATION }}/' /tmp/cannon_config.yaml @@ -123,61 +126,7 @@ jobs: - name: Verify Clickhouse has data timeout-minutes: 10 run: | - echo "Checking Clickhouse for data" - - tables=( - "canonical_beacon_block" - "canonical_beacon_block_execution_transaction" - ) - - # Define a function that prints the last 5 logs from all docker containers that have the argument in the name - pretty_print() { - local message=$1 - local color=$2 - local no_color='\033[0m' - local green='\033[0;32m' - local red='\033[0;31m' - local bright_red='\033[1;31m' - - # Choose color based on the type of message - if [ "$color" == "green" ]; then - color=$green - elif [ "$color" == "red" ]; then - color=$red - elif [ "$color" == "bright_red" ]; then - color=$bright_red - else - color=$no_color - fi - - echo -e "${color}######################${no_color}" - echo -e "${color} $message ${no_color}" - echo -e "${color}######################${no_color}" - } - - print_logs() { - echo "Logs for $container:\n\n" - docker logs --tail 5 $container - } - - # Check for any data in the tables before digging in to the individual sentries - for table in "${tables[@]}"; do - while true; do - pretty_print "Checking $table table..." "none" - data_count=$(docker exec xatu-clickhouse-01 clickhouse-client --query "SELECT COUNT(*) FROM default.$table" || true) - if [[ $data_count -gt 0 ]]; then - pretty_print "$table table has $data_count entries" "green" - break - else - pretty_print "$table table has no entries." "bright_red" - docker ps -a - - print_logs xatu-xatu-server - print_logs xatu-cannon - sleep 1 - fi - done - done + .github/cannon/assert_clickhouse.sh .github/cannon/seeding.yaml - name: Collect docker logs on failure if: failure() From 70f8350623b11ccc4160fb037276a53500e4b5aa Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Fri, 9 Aug 2024 14:44:44 +1000 Subject: [PATCH 21/26] feat: Install clickhouse client in cannon-smoke-test workflow --- .github/cannon/assert_clickhouse.sh | 7 ++++++- .github/workflows/cannon-smoke-test.yaml | 12 ++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/cannon/assert_clickhouse.sh b/.github/cannon/assert_clickhouse.sh index eefc0b6e..17a13b88 100755 --- a/.github/cannon/assert_clickhouse.sh +++ b/.github/cannon/assert_clickhouse.sh @@ -17,7 +17,12 @@ CLICKHOUSE_DB=${CLICKHOUSE_DB:-"default"} # Function to execute ClickHouse query execute_query() { - clickhouse client -h "$CLICKHOUSE_HOST" --port "$CLICKHOUSE_PORT" -u "$CLICKHOUSE_USER" --password "$CLICKHOUSE_PASSWORD" -d "$CLICKHOUSE_DB" -q "$1" + # Check if clickhouse-client is available + if command -v clickhouse-client &> /dev/null; then + clickhouse-client -h "$CLICKHOUSE_HOST" --port "$CLICKHOUSE_PORT" -u "$CLICKHOUSE_USER" --password "$CLICKHOUSE_PASSWORD" -d "$CLICKHOUSE_DB" -q "$1" + else + clickhouse client -h "$CLICKHOUSE_HOST" --port "$CLICKHOUSE_PORT" -u "$CLICKHOUSE_USER" --password "$CLICKHOUSE_PASSWORD" -d "$CLICKHOUSE_DB" -q "$1" + fi } # Check if the seeding.yaml file exists diff --git a/.github/workflows/cannon-smoke-test.yaml b/.github/workflows/cannon-smoke-test.yaml index bb3ffb1a..f7be4d41 100644 --- a/.github/workflows/cannon-smoke-test.yaml +++ b/.github/workflows/cannon-smoke-test.yaml @@ -14,6 +14,16 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 + - name: Install clickhouse client + run: | + sudo apt-get install -y apt-transport-https ca-certificates curl gnupg + curl -fsSL 'https://packages.clickhouse.com/rpm/lts/repodata/repomd.xml.key' | sudo gpg --dearmor -o /usr/share/keyrings/clickhouse-keyring.gpg + + echo "deb [signed-by=/usr/share/keyrings/clickhouse-keyring.gpg] https://packages.clickhouse.com/deb stable main" | sudo tee \ + /etc/apt/sources.list.d/clickhouse.list + sudo apt-get update + sudo apt-get install -y clickhouse-client + clickhouse-client --version - name: Pull docker compose images in the background run: | docker compose pull & @@ -92,8 +102,6 @@ jobs: ethereum: beaconNodeAddress: "https://bn-holesky-lighthouse-erigon-001.utility.production.platform.ethpandaops.io" - beaconNodeHeaders: - Authorization: "AUTH_HEADER" coordinator: address: xatu-server:8080 From e2e9323417da23d09498810b213b04c8ae58ad5a Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Fri, 9 Aug 2024 14:51:31 +1000 Subject: [PATCH 22/26] feat: Add beacon node headers to smoke test config --- .github/workflows/cannon-smoke-test.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cannon-smoke-test.yaml b/.github/workflows/cannon-smoke-test.yaml index f7be4d41..da96eae5 100644 --- a/.github/workflows/cannon-smoke-test.yaml +++ b/.github/workflows/cannon-smoke-test.yaml @@ -102,6 +102,8 @@ jobs: ethereum: beaconNodeAddress: "https://bn-holesky-lighthouse-erigon-001.utility.production.platform.ethpandaops.io" + beaconNodeHeaders: + Authorization: "AUTH_HEADER" coordinator: address: xatu-server:8080 @@ -117,7 +119,6 @@ jobs: batchTimeout: 1s exportTimeout: 30s maxExportBatchSize: 512 - EOF - name: Show config run: | cat /tmp/cannon_config.yaml From c3be585a3b1b63ebdfd4001c6b5f9e837ebb7895 Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Fri, 9 Aug 2024 15:09:24 +1000 Subject: [PATCH 23/26] feat: Add tmate setup step to smoke test workflow --- .github/workflows/cannon-smoke-test.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/cannon-smoke-test.yaml b/.github/workflows/cannon-smoke-test.yaml index da96eae5..4d62fabe 100644 --- a/.github/workflows/cannon-smoke-test.yaml +++ b/.github/workflows/cannon-smoke-test.yaml @@ -14,6 +14,10 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + with: + limit-access-to-actor: true - name: Install clickhouse client run: | sudo apt-get install -y apt-transport-https ca-certificates curl gnupg From 7576fc9359c5d92124c7bf2909f8da073d28b0f5 Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Fri, 9 Aug 2024 15:12:50 +1000 Subject: [PATCH 24/26] feat: Add 'detached' option for tmate action --- .github/workflows/cannon-smoke-test.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cannon-smoke-test.yaml b/.github/workflows/cannon-smoke-test.yaml index 4d62fabe..d7f726eb 100644 --- a/.github/workflows/cannon-smoke-test.yaml +++ b/.github/workflows/cannon-smoke-test.yaml @@ -18,6 +18,7 @@ jobs: uses: mxschmitt/action-tmate@v3 with: limit-access-to-actor: true + detached: true - name: Install clickhouse client run: | sudo apt-get install -y apt-transport-https ca-certificates curl gnupg From f0995768881501ef82d29ef3d785238ca797188a Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Fri, 9 Aug 2024 15:40:11 +1000 Subject: [PATCH 25/26] feat: Increase timeout for verifying Clickhouse data to 15 minutes --- .github/workflows/cannon-smoke-test.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/cannon-smoke-test.yaml b/.github/workflows/cannon-smoke-test.yaml index d7f726eb..72276164 100644 --- a/.github/workflows/cannon-smoke-test.yaml +++ b/.github/workflows/cannon-smoke-test.yaml @@ -113,8 +113,6 @@ jobs: address: xatu-server:8080 outputs: - - name: log - type: stdout - name: xatu type: xatu config: @@ -138,10 +136,9 @@ jobs: sleep 5 docker logs xatu-cannon - name: Verify Clickhouse has data - timeout-minutes: 10 + timeout-minutes: 15 run: | .github/cannon/assert_clickhouse.sh .github/cannon/seeding.yaml - - name: Collect docker logs on failure if: failure() uses: jwalton/gh-docker-logs@v2 From 594916b7703ecdae8fc1a3d44766819cc053717a Mon Sep 17 00:00:00 2001 From: Sam Calder-Mason Date: Fri, 9 Aug 2024 15:54:12 +1000 Subject: [PATCH 26/26] chore: comment out tmate setup in smoke test workflow --- .github/workflows/cannon-smoke-test.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cannon-smoke-test.yaml b/.github/workflows/cannon-smoke-test.yaml index 72276164..c1658a54 100644 --- a/.github/workflows/cannon-smoke-test.yaml +++ b/.github/workflows/cannon-smoke-test.yaml @@ -14,11 +14,11 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - with: - limit-access-to-actor: true - detached: true + # - name: Setup tmate session + # uses: mxschmitt/action-tmate@v3 + # with: + # limit-access-to-actor: true + # detached: true - name: Install clickhouse client run: | sudo apt-get install -y apt-transport-https ca-certificates curl gnupg