diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index dfd3f0358c..7f553e3179 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -127,6 +127,12 @@ jobs: uses: actions/setup-go@v5 with: go-version: ${{ env.min_go_version }} + - name: Install nix + uses: cachix/install-nix-action@v30 + with: + github_access_token: ${{ secrets.GITHUB_TOKEN }} + - name: Install flake dependencies + run: ./scripts/nix_develop.sh --command echo "dependencies installed" - name: Use Node.js uses: actions/setup-node@v4 with: @@ -147,12 +153,12 @@ jobs: shell: bash run: ./scripts/build.sh - name: Run Warp E2E Tests - uses: ava-labs/avalanchego/.github/actions/run-monitored-tmpnet-cmd@v1.11.13 + uses: ava-labs/avalanchego/.github/actions/run-monitored-tmpnet-cmd@15c496b09 with: - run: AVALANCHEGO_BUILD_PATH=/tmp/e2e-test/avalanchego ./scripts/run_ginkgo_warp.sh - prometheus_id: ${{ secrets.PROMETHEUS_ID || '' }} + run: AVALANCHEGO_BUILD_PATH=/tmp/e2e-test/avalanchego ./scripts/nix_develop.sh --impure --command ./scripts/run_ginkgo_warp.sh --enable-collectors + prometheus_username: ${{ secrets.PROMETHEUS_ID || '' }} prometheus_password: ${{ secrets.PROMETHEUS_PASSWORD || '' }} - loki_id: ${{ secrets.LOKI_ID || '' }} + loki_username: ${{ secrets.LOKI_ID || '' }} loki_password: ${{ secrets.LOKI_PASSWORD || '' }} - name: Upload tmpnet network dir for warp testing uses: ava-labs/avalanchego/.github/actions/upload-tmpnet-artifact@v1-actions @@ -171,6 +177,12 @@ jobs: uses: actions/setup-go@v5 with: go-version: ${{ env.min_go_version }} + - name: Install nix + uses: cachix/install-nix-action@v30 + with: + github_access_token: ${{ secrets.GITHUB_TOKEN }} + - name: Install flake dependencies + run: ./scripts/nix_develop.sh --command echo "dependencies installed" - name: Install AvalancheGo Release shell: bash run: BASEDIR=/tmp/e2e-test AVALANCHEGO_BUILD_PATH=/tmp/e2e-test/avalanchego ./scripts/install_avalanchego_release.sh @@ -178,12 +190,12 @@ jobs: shell: bash run: ./scripts/build.sh - name: Run E2E Load Tests - uses: ava-labs/avalanchego/.github/actions/run-monitored-tmpnet-cmd@v1.11.13 + uses: ava-labs/avalanchego/.github/actions/run-monitored-tmpnet-cmd@15c496b09 with: - run: AVALANCHEGO_BUILD_PATH=/tmp/e2e-test/avalanchego ./scripts/run_ginkgo_load.sh - prometheus_id: ${{ secrets.PROMETHEUS_ID || '' }} + run: AVALANCHEGO_BUILD_PATH=/tmp/e2e-test/avalanchego ./scripts/nix_develop.sh --impure --command ./scripts/run_ginkgo_load.sh --enable-collectors + prometheus_username: ${{ secrets.PROMETHEUS_ID || '' }} prometheus_password: ${{ secrets.PROMETHEUS_PASSWORD || '' }} - loki_id: ${{ secrets.LOKI_ID || '' }} + loki_username: ${{ secrets.LOKI_ID || '' }} loki_password: ${{ secrets.LOKI_PASSWORD || '' }} - name: Upload tmpnet network dir for load testing uses: ava-labs/avalanchego/.github/actions/upload-tmpnet-artifact@v1-actions diff --git a/go.mod b/go.mod index 13197720b3..008f13a91a 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.22.8 require ( github.com/VictoriaMetrics/fastcache v1.12.1 github.com/antithesishq/antithesis-sdk-go v0.3.8 - github.com/ava-labs/avalanchego v1.12.2 + github.com/ava-labs/avalanchego v1.12.3-warp-verify4 github.com/cespare/cp v0.1.0 github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233 github.com/davecgh/go-spew v1.1.1 @@ -57,7 +57,7 @@ require ( require ( github.com/DataDog/zstd v1.5.2 // indirect github.com/NYTimes/gziphandler v1.1.1 // indirect - github.com/ava-labs/coreth v0.14.1-rc.1 // indirect + github.com/ava-labs/coreth v0.14.2-verify-interface4 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bits-and-blooms/bitset v1.10.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -174,3 +174,5 @@ require ( sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect sigs.k8s.io/yaml v1.3.0 // indirect ) + +replace github.com/ava-labs/avalanchego => github.com/ava-labs/avalanchego v1.12.3-0.20250202045707-15c496b09f92 diff --git a/go.sum b/go.sum index cb8666e5e8..69c247dd46 100644 --- a/go.sum +++ b/go.sum @@ -60,10 +60,10 @@ github.com/antithesishq/antithesis-sdk-go v0.3.8/go.mod h1:IUpT2DPAKh6i/YhSbt6Gl github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= -github.com/ava-labs/avalanchego v1.12.2 h1:vZroUgB5xMMczDQnw9etDD1XhZsejFlKky+ZZv8wOKc= -github.com/ava-labs/avalanchego v1.12.2/go.mod h1:uEDLbAUPcGCfDWW680rVfysEofUe/jWte5qQk0j5hMs= -github.com/ava-labs/coreth v0.14.1-rc.1 h1:U72XlRm/fKyASmjThsWzfO/ZRvu1kaONFaX+KdJNxIc= -github.com/ava-labs/coreth v0.14.1-rc.1/go.mod h1:lxDSXLcrszMo0N/PVJzfZ//H+bRwXF/KQWtpEYgXZqM= +github.com/ava-labs/avalanchego v1.12.3-0.20250202045707-15c496b09f92 h1:92IhW5Al44mwwotcOjj0vYfAlqlliTN76ScKGW9wKGU= +github.com/ava-labs/avalanchego v1.12.3-0.20250202045707-15c496b09f92/go.mod h1:PkpeGfEdsTccz87SDHidto21U5+BSBGZ+BNPW6Zplbc= +github.com/ava-labs/coreth v0.14.2-verify-interface4 h1:AYeN8R6ZnNu/K8KwBQD4ELphvLpvNxAjkX3SBcJ+bps= +github.com/ava-labs/coreth v0.14.2-verify-interface4/go.mod h1:wQaeiolUP0vCHS1mC0lIMXzHF05vbjugSLCBFDnO4Gs= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= diff --git a/scripts/nix_develop.sh b/scripts/nix_develop.sh new file mode 100755 index 0000000000..007285a69e --- /dev/null +++ b/scripts/nix_develop.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -euo pipefail + +# Load the versions +SUBNET_EVM_PATH=$( + cd "$(dirname "${BASH_SOURCE[0]}")" + cd .. && pwd +) +source "$SUBNET_EVM_PATH"/scripts/versions.sh + +nix develop github:ava-labs/avalanchego?ref="${AVALANCHE_VERSION}" "${@}" diff --git a/scripts/run_ginkgo_load.sh b/scripts/run_ginkgo_load.sh index 6dd6c58757..bbe21ca3e5 100755 --- a/scripts/run_ginkgo_load.sh +++ b/scripts/run_ginkgo_load.sh @@ -26,4 +26,4 @@ if [[ -n "${AVALANCHEGO_BUILD_PATH}" ]]; then echo "Running with extra args:" "${EXTRA_ARGS[@]}" fi -ginkgo -vv --label-filter="${GINKGO_LABEL_FILTER:-}" ./tests/load -- "${EXTRA_ARGS[@]}" +ginkgo -vv --label-filter="${GINKGO_LABEL_FILTER:-}" ./tests/load -- "${EXTRA_ARGS[@]}" "${@}" diff --git a/scripts/run_ginkgo_warp.sh b/scripts/run_ginkgo_warp.sh index 0d7c3abd3a..3502cedcb0 100755 --- a/scripts/run_ginkgo_warp.sh +++ b/scripts/run_ginkgo_warp.sh @@ -27,4 +27,4 @@ if [[ -n "${AVALANCHEGO_BUILD_PATH}" ]]; then echo "Running with extra args:" "${EXTRA_ARGS[@]}" fi -ginkgo -vv --label-filter="${GINKGO_LABEL_FILTER:-}" ./tests/warp -- "${EXTRA_ARGS[@]}" +ginkgo -vv --label-filter="${GINKGO_LABEL_FILTER:-}" ./tests/warp -- "${EXTRA_ARGS[@]}" "${@}" diff --git a/scripts/run_prometheus.sh b/scripts/run_prometheus.sh deleted file mode 100755 index dce9ef1e30..0000000000 --- a/scripts/run_prometheus.sh +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -# Starts a prometheus instance in agent-mode, forwarding to a central -# instance. Intended to enable metrics collection from temporary networks running -# locally and in CI. -# -# The prometheus instance will remain running in the background and will forward -# metrics to the central instance for all tmpnet networks. -# -# To stop it: -# -# $ kill -9 `cat ~/.tmpnet/prometheus/run.pid` && rm ~/.tmpnet/prometheus/run.pid -# - -# e.g., -# PROMETHEUS_ID= PROMETHEUS_PASSWORD= ./scripts/run_prometheus.sh -if ! [[ "$0" =~ scripts/run_prometheus.sh ]]; then - echo "must be run from repository root" - exit 255 -fi - -PROMETHEUS_WORKING_DIR="${HOME}/.tmpnet/prometheus" -PIDFILE="${PROMETHEUS_WORKING_DIR}"/run.pid - -# First check if an agent-mode prometheus is already running. A single instance can collect -# metrics from all local temporary networks. -if pgrep --pidfile="${PIDFILE}" -f 'prometheus.*enable-feature=agent' &> /dev/null; then - echo "prometheus is already running locally with --enable-feature=agent" - exit 0 -fi - -PROMETHEUS_URL="${PROMETHEUS_URL:-https://prometheus-poc.avax-dev.network}" -if [[ -z "${PROMETHEUS_URL}" ]]; then - echo "Please provide a value for PROMETHEUS_URL" - exit 1 -fi - -PROMETHEUS_ID="${PROMETHEUS_ID:-}" -if [[ -z "${PROMETHEUS_ID}" ]]; then - echo "Please provide a value for PROMETHEUS_ID" - exit 1 -fi - -PROMETHEUS_PASSWORD="${PROMETHEUS_PASSWORD:-}" -if [[ -z "${PROMETHEUS_PASSWORD}" ]]; then - echo "Plase provide a value for PROMETHEUS_PASSWORD" - exit 1 -fi - -# This was the LTS version when this script was written. Probably not -# much reason to update it unless something breaks since the usage -# here is only to collect metrics from temporary networks. -VERSION="2.45.3" - -# Ensure the prometheus command is locally available -CMD=prometheus -if ! command -v "${CMD}" &> /dev/null; then - # Try to use a local version - CMD="${PWD}/bin/prometheus" - if ! command -v "${CMD}" &> /dev/null; then - echo "prometheus not found, attempting to install..." - - # Determine the arch - if which sw_vers &> /dev/null; then - echo "on macos, only amd64 binaries are available so rosetta is required on apple silicon machines." - echo "to avoid using rosetta, install via homebrew: brew install prometheus" - DIST=darwin - else - ARCH="$(uname -i)" - if [[ "${ARCH}" != "x86_64" ]]; then - echo "on linux, only amd64 binaries are available. manual installation of prometheus is required." - exit 1 - else - DIST="linux" - fi - fi - - # Install the specified release - PROMETHEUS_FILE="prometheus-${VERSION}.${DIST}-amd64" - URL="https://github.com/prometheus/prometheus/releases/download/v${VERSION}/${PROMETHEUS_FILE}.tar.gz" - curl -s -L "${URL}" | tar zxv -C /tmp > /dev/null - mkdir -p "$(dirname "${CMD}")" - cp /tmp/"${PROMETHEUS_FILE}/prometheus" "${CMD}" - fi -fi - -# Configure prometheus -FILE_SD_PATH="${PROMETHEUS_WORKING_DIR}/file_sd_configs" -mkdir -p "${FILE_SD_PATH}" - -echo "writing configuration..." -cat >"${PROMETHEUS_WORKING_DIR}"/prometheus.yaml < prometheus.log 2>&1 & -echo $! > "${PIDFILE}" -echo "running with pid $(cat "${PIDFILE}")" diff --git a/scripts/run_promtail.sh b/scripts/run_promtail.sh deleted file mode 100755 index 5811dcf06f..0000000000 --- a/scripts/run_promtail.sh +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -# Starts a promtail instance to collect logs from temporary networks -# running locally and in CI. -# -# The promtail instance will remain running in the background and will forward -# logs to the central instance for all tmpnet networks. -# -# To stop it: -# -# $ kill -9 `cat ~/.tmpnet/promtail/run.pid` && rm ~/.tmpnet/promtail/run.pid -# - -# e.g., -# LOKI_ID= LOKI_PASSWORD= ./scripts/run_promtail.sh -if ! [[ "$0" =~ scripts/run_promtail.sh ]]; then - echo "must be run from repository root" - exit 255 -fi - -PROMTAIL_WORKING_DIR="${HOME}/.tmpnet/promtail" -PIDFILE="${PROMTAIL_WORKING_DIR}"/run.pid - -# First check if promtail is already running. A single instance can -# collect logs from all local temporary networks. -if pgrep --pidfile="${PIDFILE}" &> /dev/null; then - echo "promtail is already running" - exit 0 -fi - -LOKI_URL="${LOKI_URL:-https://loki-poc.avax-dev.network}" -if [[ -z "${LOKI_URL}" ]]; then - echo "Please provide a value for LOKI_URL" - exit 1 -fi - -LOKI_ID="${LOKI_ID:-}" -if [[ -z "${LOKI_ID}" ]]; then - echo "Please provide a value for LOKI_ID" - exit 1 -fi - -LOKI_PASSWORD="${LOKI_PASSWORD:-}" -if [[ -z "${LOKI_PASSWORD}" ]]; then - echo "Plase provide a value for LOKI_PASSWORD" - exit 1 -fi - -# Version as of this writing -VERSION="v2.9.5" - -# Ensure the promtail command is locally available -CMD=promtail -if ! command -v "${CMD}" &> /dev/null; then - # Try to use a local version - CMD="${PWD}/bin/promtail" - if ! command -v "${CMD}" &> /dev/null; then - echo "promtail not found, attempting to install..." - # Determine the arch - if which sw_vers &> /dev/null; then - DIST="darwin-$(uname -m)" - else - ARCH="$(uname -i)" - if [[ "${ARCH}" == "aarch64" ]]; then - ARCH="arm64" - elif [[ "${ARCH}" == "x86_64" ]]; then - ARCH="amd64" - fi - DIST="linux-${ARCH}" - fi - - # Install the specified release - PROMTAIL_FILE="promtail-${DIST}" - ZIP_PATH="/tmp/${PROMTAIL_FILE}.zip" - BIN_DIR="$(dirname "${CMD}")" - URL="https://github.com/grafana/loki/releases/download/${VERSION}/promtail-${DIST}.zip" - curl -L -o "${ZIP_PATH}" "${URL}" - unzip "${ZIP_PATH}" -d "${BIN_DIR}" - mv "${BIN_DIR}/${PROMTAIL_FILE}" "${CMD}" - fi -fi - -# Configure promtail -FILE_SD_PATH="${PROMTAIL_WORKING_DIR}/file_sd_configs" -mkdir -p "${FILE_SD_PATH}" - -echo "writing configuration..." -cat >"${PROMTAIL_WORKING_DIR}"/promtail.yaml < promtail.log 2>&1 & -echo $! > "${PIDFILE}" -echo "running with pid $(cat "${PIDFILE}")" diff --git a/scripts/versions.sh b/scripts/versions.sh index 2f0a46f660..869d7586d6 100644 --- a/scripts/versions.sh +++ b/scripts/versions.sh @@ -4,5 +4,5 @@ # shellcheck disable=SC2034 # Don't export them as they're used in the context of other calls -AVALANCHE_VERSION=${AVALANCHE_VERSION:-'v1.12.2'} +AVALANCHE_VERSION=${AVALANCHE_VERSION:-'15c496b09f92cc5ac23b5aa2937d17a258d9a14f'} GINKGO_VERSION=${GINKGO_VERSION:-'v2.2.0'}