diff --git a/.github/workflows/verify-holesky.yaml b/.github/workflows/verify-holesky.yaml new file mode 100644 index 0000000..6b08d23 --- /dev/null +++ b/.github/workflows/verify-holesky.yaml @@ -0,0 +1,16 @@ +name: Verify Sepolia + +on: + schedule: + - cron: '*/30 * * * *' + workflow_dispatch: + +jobs: + run: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Run script + run: ./.hack/verify.sh holesky diff --git a/.github/workflows/verify-sepolia.yaml b/.github/workflows/verify-sepolia.yaml new file mode 100644 index 0000000..0a8111e --- /dev/null +++ b/.github/workflows/verify-sepolia.yaml @@ -0,0 +1,16 @@ +name: Verify Sepolia + +on: + schedule: + - cron: '*/30 * * * *' + workflow_dispatch: + +jobs: + run: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Run script + run: ./.hack/verify.sh sepolia diff --git a/.hack/verify.sh b/.hack/verify.sh new file mode 100755 index 0000000..a121730 --- /dev/null +++ b/.hack/verify.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# Set the baseURL and network as configurable variables +network=${1:-sepolia} +baseURL=${2:-https://snapshots.ethpandaops.io} + +# Array to store block numbers +block_numbers=() + +# List of clients +clients=("geth" "besu" "nethermind" "reth") + +echo "Verifying snapshot block numbers for network: $network" + +# Loop through each client and fetch block numbers +for client in "${clients[@]}"; do + block_number=$(printf '%d\n' $(curl -s "$baseURL/$network/$client/latest/_snapshot_eth_getBlockByNumber.json" | jq -r '.result.number')) + block_numbers+=("$block_number") + echo "Block: $block_number ($client)" +done + +# Verify if all block numbers are the same +first_block_number="${block_numbers[0]}" +all_same=true + +for i in "${!clients[@]}"; do + if [[ "${block_numbers[$i]}" != "$first_block_number" ]]; then + echo "Block number mismatch detected for client: ${clients[$i]}" + all_same=false + fi +done + +if [ "$all_same" = true ]; then + echo "✅ All block numbers are the same: https://${network}.etherscan.io/block/${first_block_number}" +else + echo "❌ Some block numbers are different." + exit 1 +fi