diff --git a/.github/benchmark-trigger.txt b/.github/benchmark-trigger.txt new file mode 100644 index 0000000000..bb09eb117f --- /dev/null +++ b/.github/benchmark-trigger.txt @@ -0,0 +1 @@ +# Benchmark trigger 2026-03-05T17:19:09Z diff --git a/.github/workflows/apply-benchmark-patch.yml b/.github/workflows/apply-benchmark-patch.yml index 16b499bea6..31c9bb1b41 100644 --- a/.github/workflows/apply-benchmark-patch.yml +++ b/.github/workflows/apply-benchmark-patch.yml @@ -13,7 +13,9 @@ permissions: jobs: apply: if: ${{ github.event.label.name == 'apply-benchmark-patch' }} - runs-on: Benchmarking + runs-on: + - self-hosted + - fireactions-benchmarking steps: - name: Check out PR branch diff --git a/.github/workflows/bench-docker-publish-dryrun.yml b/.github/workflows/bench-docker-publish-dryrun.yml new file mode 100644 index 0000000000..402776a3a4 --- /dev/null +++ b/.github/workflows/bench-docker-publish-dryrun.yml @@ -0,0 +1,64 @@ +name: Bench Docker Publish Dry Run + +on: + push: + branches: + - fireactions-runners + workflow_dispatch: + inputs: + branch-or-tag: + description: "Branch or tag to use for the Docker tag and ref to checkout (optional)" + required: false + default: "" + runner_label: + description: "Self-hosted runner label to benchmark on" + required: false + default: "fireactions-fastcores" + +concurrency: + group: bench-docker-dryrun-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + build: + runs-on: [self-hosted, "${{ github.event.inputs.runner_label || 'fireactions-fastcores' }}"] + + steps: + - name: Determine Docker tag and ref + run: | + branch_or_tag="${{ github.event.inputs.branch-or-tag || github.ref_name }}" + echo "Determined branch or tag: $branch_or_tag" + echo "tag=$branch_or_tag" >> "$GITHUB_ENV" + echo "ref=$branch_or_tag" >> "$GITHUB_ENV" + + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ env.ref }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build Docker image without push (amd64) + uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile.bench + push: false + platforms: linux/amd64 + tags: subtensor-bench:${{ env.tag }}-amd64 + + - name: Build Docker image without push (arm64) + uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile.bench + push: false + platforms: linux/arm64 + tags: subtensor-bench:${{ env.tag }}-arm64 diff --git a/.github/workflows/cargo-audit.yml b/.github/workflows/cargo-audit.yml index 04046c11d4..c706c8223e 100644 --- a/.github/workflows/cargo-audit.yml +++ b/.github/workflows/cargo-audit.yml @@ -13,7 +13,7 @@ concurrency: jobs: cargo-audit: name: cargo audit - runs-on: [self-hosted, type-ccx13] + runs-on: [self-hosted, fireactions-light] if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-cargo-audit') }} steps: - name: Check-out repositoroy under $GITHUB_WORKSPACE diff --git a/.github/workflows/check-bittensor-e2e-tests.yml b/.github/workflows/check-bittensor-e2e-tests.yml index bad36f7d9d..dea4c4ea9f 100644 --- a/.github/workflows/check-bittensor-e2e-tests.yml +++ b/.github/workflows/check-bittensor-e2e-tests.yml @@ -190,7 +190,7 @@ jobs: strategy: matrix: platform: - - runner: [self-hosted, type-ccx33] + - runner: [self-hosted, fireactions-heavy] triple: x86_64-unknown-linux-gnu arch: amd64 runtime: ["fast-runtime", "non-fast-runtime"] diff --git a/.github/workflows/check-devnet.yml b/.github/workflows/check-devnet.yml index 8d3db55001..d6014bc009 100644 --- a/.github/workflows/check-devnet.yml +++ b/.github/workflows/check-devnet.yml @@ -15,7 +15,7 @@ env: jobs: check-spec-version: name: Check spec_version bump - runs-on: [self-hosted, type-ccx33] + runs-on: [self-hosted, fireactions-heavy] if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-spec-version-bump') }} steps: - name: Dependencies diff --git a/.github/workflows/check-docker.yml b/.github/workflows/check-docker.yml index da5054fd6d..98a14eb659 100644 --- a/.github/workflows/check-docker.yml +++ b/.github/workflows/check-docker.yml @@ -9,7 +9,7 @@ concurrency: jobs: build: - runs-on: [self-hosted, type-ccx33] + runs-on: [self-hosted, fireactions-heavy] steps: - name: Checkout code diff --git a/.github/workflows/check-finney.yml b/.github/workflows/check-finney.yml index 6b056ef97e..2936e3052a 100644 --- a/.github/workflows/check-finney.yml +++ b/.github/workflows/check-finney.yml @@ -15,7 +15,7 @@ env: jobs: check-spec-version: name: Check spec_version bump - runs-on: [self-hosted, type-ccx33] + runs-on: [self-hosted, fireactions-heavy] if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-spec-version-bump') }} steps: - name: Dependencies diff --git a/.github/workflows/check-node-compat.yml b/.github/workflows/check-node-compat.yml index b52a7a88ba..30495b45f2 100644 --- a/.github/workflows/check-node-compat.yml +++ b/.github/workflows/check-node-compat.yml @@ -15,7 +15,7 @@ env: jobs: build: name: build ${{ matrix.version.name }} - runs-on: [self-hosted, type-ccx33] + runs-on: [self-hosted, fireactions-heavy] if: contains(github.event.pull_request.labels.*.name, 'check-node-compat') env: RUST_BACKTRACE: full @@ -60,7 +60,7 @@ jobs: test: needs: [build] - runs-on: [self-hosted, type-ccx33] + runs-on: [self-hosted, fireactions-heavy] steps: - name: Download old node binary uses: actions/download-artifact@v4 @@ -85,4 +85,4 @@ jobs: - name: Run test working-directory: ${{ github.workspace }}/.github/workflows/check-node-compat - run: npm run test \ No newline at end of file + run: npm run test diff --git a/.github/workflows/check-rust.yml b/.github/workflows/check-rust.yml index 4b975959d0..3c0fcaa8b7 100644 --- a/.github/workflows/check-rust.yml +++ b/.github/workflows/check-rust.yml @@ -23,7 +23,7 @@ jobs: # runs cargo fmt cargo-fmt: name: cargo fmt - runs-on: [self-hosted, type-ccx13] + runs-on: [self-hosted, fireactions-light] env: RUST_BACKTRACE: full steps: @@ -67,7 +67,7 @@ jobs: cargo-clippy-default-features: name: cargo clippy - runs-on: [self-hosted, type-ccx13] + runs-on: [self-hosted, fireactions-light] env: RUST_BACKTRACE: full SKIP_WASM_BUILD: 1 @@ -97,7 +97,7 @@ jobs: cargo-check-lints: name: check custom lints - runs-on: [self-hosted, type-ccx13] + runs-on: [self-hosted, fireactions-light] env: RUSTFLAGS: -D warnings RUST_BACKTRACE: full @@ -130,7 +130,7 @@ jobs: cargo-clippy-all-features: name: cargo clippy --all-features - runs-on: [self-hosted, type-ccx13] + runs-on: [self-hosted, fireactions-light] env: RUST_BACKTRACE: full SKIP_WASM_BUILD: 1 @@ -161,7 +161,7 @@ jobs: # runs cargo test --workspace --all-features cargo-test: name: cargo test - runs-on: [self-hosted, type-ccx43] + runs-on: [self-hosted, fireactions-heavy] env: RUST_BACKTRACE: full SKIP_WASM_BUILD: 1 @@ -191,7 +191,7 @@ jobs: # ensures cargo fix has no trivial changes that can be applied cargo-fix: name: cargo fix - runs-on: [self-hosted, type-ccx13] + runs-on: [self-hosted, fireactions-light] env: RUST_BACKTRACE: full SKIP_WASM_BUILD: 1 @@ -230,7 +230,7 @@ jobs: check-feature-propagation: name: zepter run check - runs-on: [self-hosted, type-ccx13] + runs-on: [self-hosted, fireactions-light] steps: - name: Checkout diff --git a/.github/workflows/check-testnet.yml b/.github/workflows/check-testnet.yml index 219d99051f..9d6f168109 100644 --- a/.github/workflows/check-testnet.yml +++ b/.github/workflows/check-testnet.yml @@ -15,7 +15,7 @@ env: jobs: check-spec-version: name: Check spec_version bump - runs-on: [self-hosted, type-ccx33] + runs-on: [self-hosted, fireactions-heavy] if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-spec-version-bump') }} steps: - name: Dependencies diff --git a/.github/workflows/contract-tests.yml b/.github/workflows/contract-tests.yml index d524af0c64..a8182097a7 100644 --- a/.github/workflows/contract-tests.yml +++ b/.github/workflows/contract-tests.yml @@ -24,7 +24,7 @@ permissions: jobs: run: - runs-on: [self-hosted, type-ccx13] + runs-on: [self-hosted, fireactions-light] env: RUST_BACKTRACE: full steps: diff --git a/.github/workflows/docker-localnet.yml b/.github/workflows/docker-localnet.yml index 2218e886ea..1d5d246d05 100644 --- a/.github/workflows/docker-localnet.yml +++ b/.github/workflows/docker-localnet.yml @@ -95,7 +95,7 @@ jobs: matrix: platform: # triple names used `in scripts/install_prebuilt_binaries.sh` file - - runner: [self-hosted, type-ccx33] + - runner: [self-hosted, fireactions-heavy] triple: x86_64-unknown-linux-gnu arch: amd64 - runner: [ubuntu-24.04-arm] @@ -162,7 +162,7 @@ jobs: # Collect all artifacts and publish them to docker repo docker: needs: [setup, artifacts] - runs-on: [self-hosted, type-ccx33] + runs-on: [self-hosted, fireactions-heavy] defaults: run: working-directory: ${{ github.workspace }} diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index a60f0f9d82..9f2de4ec88 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -27,7 +27,7 @@ permissions: jobs: publish: - runs-on: [self-hosted, type-ccx53, type-ccx43, type-ccx33] + runs-on: [self-hosted, fireactions-heavy] steps: - name: Determine Docker tag and ref @@ -71,4 +71,4 @@ jobs: platforms: linux/amd64,linux/arm64 tags: | ghcr.io/${{ github.repository }}:${{ env.tag }} - ${{ env.latest_tag == 'true' && format('ghcr.io/{0}:latest', github.repository) || '' }} \ No newline at end of file + ${{ env.latest_tag == 'true' && format('ghcr.io/{0}:latest', github.repository) || '' }} diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index f04d592a64..38fcc74ec7 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -19,7 +19,7 @@ permissions: jobs: # Build the node binary in both variants and share as artifacts. build: - runs-on: [self-hosted, type-ccx33] + runs-on: [self-hosted, fireactions-heavy] timeout-minutes: 60 strategy: matrix: @@ -95,7 +95,7 @@ jobs: test: needs: [build, discover] if: ${{ needs.discover.outputs.packages != '[]' }} - runs-on: [self-hosted, type-ccx33] + runs-on: [self-hosted, fireactions-heavy] timeout-minutes: 30 strategy: fail-fast: false diff --git a/.github/workflows/hotfixes.yml b/.github/workflows/hotfixes.yml index 7fcf28efb6..0e0e74c640 100644 --- a/.github/workflows/hotfixes.yml +++ b/.github/workflows/hotfixes.yml @@ -10,7 +10,7 @@ permissions: jobs: handle-hotfix-pr: - runs-on: [self-hosted, type-ccx13] + runs-on: [self-hosted, fireactions-light] steps: - name: Check if PR is a hotfix into `main` if: > diff --git a/.github/workflows/label-triggers.yml b/.github/workflows/label-triggers.yml index 8c7803b2e3..51147e2565 100644 --- a/.github/workflows/label-triggers.yml +++ b/.github/workflows/label-triggers.yml @@ -13,7 +13,7 @@ permissions: jobs: comment_on_breaking_change: - runs-on: [self-hosted, type-ccx13] + runs-on: [self-hosted, fireactions-light] steps: - name: Check if 'breaking change' label is added if: github.event.label.name == 'breaking-change' @@ -25,4 +25,4 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, body: '@opentensor/cerebrum / @opentensor/gyrus / @opentensor/cortex breaking change detected! Please prepare accordingly!' - }) \ No newline at end of file + }) diff --git a/.github/workflows/require-clean-merges.yml b/.github/workflows/require-clean-merges.yml index dd7a8829e7..9f09bff05f 100644 --- a/.github/workflows/require-clean-merges.yml +++ b/.github/workflows/require-clean-merges.yml @@ -9,7 +9,7 @@ on: jobs: assert-clean-merges: - runs-on: [self-hosted, type-ccx13] + runs-on: [self-hosted, fireactions-light] steps: - name: Checkout Repository uses: actions/checkout@v4 diff --git a/.github/workflows/run-benchmarks.yml b/.github/workflows/run-benchmarks.yml index 12df3f8ab6..5035d53459 100644 --- a/.github/workflows/run-benchmarks.yml +++ b/.github/workflows/run-benchmarks.yml @@ -2,6 +2,7 @@ name: Validate-Benchmarks on: + push: pull_request: types: [opened, synchronize] workflow_dispatch: @@ -16,30 +17,38 @@ concurrency: jobs: validate-benchmarks: - runs-on: Benchmarking + runs-on: + - self-hosted + - fireactions-benchmarking env: SKIP_BENCHMARKS: "0" steps: - name: Check out PR branch - if: ${{ env.SKIP_BENCHMARKS != '1' }} + if: ${{ github.event_name == 'pull_request' && env.SKIP_BENCHMARKS != '1' }} uses: actions/checkout@v4 with: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.event.pull_request.head.ref }} fetch-depth: 0 + - name: Check out branch + if: ${{ github.event_name != 'pull_request' && env.SKIP_BENCHMARKS != '1' }} + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install GitHub CLI - if: ${{ env.SKIP_BENCHMARKS != '1' }} + if: ${{ github.event_name == 'pull_request' && env.SKIP_BENCHMARKS != '1' }} run: | sudo DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a apt-get update sudo DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a apt-get install -y --no-install-recommends -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" gh echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token - # (1) — first skip‑label check + # (1) — first skip-label check - name: Check skip label - if: ${{ env.SKIP_BENCHMARKS != '1' }} + if: ${{ github.event_name == 'pull_request' && env.SKIP_BENCHMARKS != '1' }} run: | labels=$(gh pr view ${{ github.event.pull_request.number }} \ --repo "${{ github.repository }}" \ @@ -57,7 +66,7 @@ jobs: # (2) - name: Check skip label - if: ${{ env.SKIP_BENCHMARKS != '1' }} + if: ${{ github.event_name == 'pull_request' && env.SKIP_BENCHMARKS != '1' }} run: | labels=$(gh pr view ${{ github.event.pull_request.number }} \ --repo "${{ github.repository }}" \ @@ -76,7 +85,7 @@ jobs: # (3) - name: Check skip label - if: ${{ env.SKIP_BENCHMARKS != '1' }} + if: ${{ github.event_name == 'pull_request' && env.SKIP_BENCHMARKS != '1' }} run: | labels=$(gh pr view ${{ github.event.pull_request.number }} \ --repo "${{ github.repository }}" \ @@ -95,7 +104,7 @@ jobs: # (4) - name: Check skip label - if: ${{ env.SKIP_BENCHMARKS != '1' }} + if: ${{ github.event_name == 'pull_request' && env.SKIP_BENCHMARKS != '1' }} run: | labels=$(gh pr view ${{ github.event.pull_request.number }} \ --repo "${{ github.repository }}" \ @@ -112,7 +121,7 @@ jobs: # (5) - name: Check skip label - if: ${{ env.SKIP_BENCHMARKS != '1' }} + if: ${{ github.event_name == 'pull_request' && env.SKIP_BENCHMARKS != '1' }} run: | labels=$(gh pr view ${{ github.event.pull_request.number }} \ --repo "${{ github.repository }}" \ @@ -164,7 +173,7 @@ jobs: # (6) — final check after run - name: Check skip label after run - if: ${{ env.SKIP_BENCHMARKS != '1' }} + if: ${{ github.event_name == 'pull_request' && env.SKIP_BENCHMARKS != '1' }} run: | labels=$(gh pr view ${{ github.event.pull_request.number }} \ --repo "${{ github.repository }}" \ diff --git a/.github/workflows/rustdocs.yml b/.github/workflows/rustdocs.yml index 5b3b1d5baf..15538cd776 100644 --- a/.github/workflows/rustdocs.yml +++ b/.github/workflows/rustdocs.yml @@ -15,7 +15,7 @@ env: jobs: build: - runs-on: [self-hosted, type-ccx13] + runs-on: [self-hosted, fireactions-light] steps: - name: Checkout code @@ -54,7 +54,7 @@ jobs: deploy: needs: build - runs-on: [self-hosted, type-ccx13] + runs-on: [self-hosted, fireactions-light] permissions: pages: write diff --git a/.github/workflows/try-runtime.yml b/.github/workflows/try-runtime.yml index 98fa613d6a..2cecce2a58 100644 --- a/.github/workflows/try-runtime.yml +++ b/.github/workflows/try-runtime.yml @@ -14,7 +14,7 @@ jobs: check-devnet: name: check devnet if: github.base_ref != 'main' - runs-on: [self-hosted, type-ccx33] + runs-on: [self-hosted, fireactions-tryruntime] steps: - name: Checkout sources uses: actions/checkout@v4 @@ -45,7 +45,7 @@ jobs: check-testnet: name: check testnet if: github.base_ref != 'main' - runs-on: [self-hosted, type-ccx33] + runs-on: [self-hosted, fireactions-tryruntime] steps: - name: Checkout sources uses: actions/checkout@v4 @@ -76,7 +76,7 @@ jobs: check-finney: name: check finney # if: github.base_ref == 'testnet' || github.base_ref == 'devnet' || github.base_ref == 'main' - runs-on: [self-hosted, type-ccx33] + runs-on: [self-hosted, fireactions-tryruntime-finney] steps: - name: Checkout sources uses: actions/checkout@v4 diff --git a/.github/workflows/update-chainspec.yml b/.github/workflows/update-chainspec.yml index ad7f0fc943..2ec99c6925 100644 --- a/.github/workflows/update-chainspec.yml +++ b/.github/workflows/update-chainspec.yml @@ -18,7 +18,7 @@ env: jobs: update-chainspecs: - runs-on: [self-hosted, type-ccx33] + runs-on: [self-hosted, fireactions-heavy] permissions: contents: write if: > diff --git a/Dockerfile.bench b/Dockerfile.bench new file mode 100644 index 0000000000..eac79c16c8 --- /dev/null +++ b/Dockerfile.bench @@ -0,0 +1,58 @@ +# ------------------------------------------------------------------------------ +# Subtensor benchmark Dockerfile +# - Builds the production node image only +# - Uses a direct cargo build to mirror the production build shape +# ------------------------------------------------------------------------------ + +ARG BASE_IMAGE=rust:latest +ARG RUST_TOOLCHAIN=1.89 + +FROM ${BASE_IMAGE} AS builder +ARG RUST_TOOLCHAIN + +LABEL ai.opentensor.image.authors="operations@opentensor.ai" \ + ai.opentensor.image.vendor="Opentensor Foundation" \ + ai.opentensor.image.title="opentensor/subtensor" \ + ai.opentensor.image.description="Opentensor Subtensor Blockchain" \ + ai.opentensor.image.documentation="https://docs.bittensor.com" + +ENV RUST_BACKTRACE=1 +WORKDIR /build + +COPY . /build +COPY rust-toolchain.toml /build/rust-toolchain.toml + +RUN rustup toolchain install ${RUST_TOOLCHAIN} && \ + rustup target add wasm32-unknown-unknown wasm32v1-none --toolchain ${RUST_TOOLCHAIN} && \ + apt-get update && \ + apt-get install -y --no-install-recommends \ + curl build-essential protobuf-compiler clang git pkg-config libssl-dev && \ + rm -rf /var/lib/apt/lists/* +RUN cargo +${RUST_TOOLCHAIN} build -p node-subtensor --profile production --features "metadata-hash" --locked && \ + test -e /build/target/production/node-subtensor + +FROM ${BASE_IMAGE} AS subtensor + +RUN addgroup --system --gid 10001 subtensor && \ + adduser --system --uid 10001 --gid 10001 --home /home/subtensor --disabled-password subtensor + +RUN apt-get update && \ + apt-get install -y gosu && \ + rm -rf /var/lib/apt/lists/* + +RUN mkdir -p /data && chown -R subtensor:subtensor /data +WORKDIR /home/subtensor + +COPY --chown=subtensor:subtensor --from=builder /build/*.json ./ +COPY --chown=subtensor:subtensor --from=builder /build/chainspecs/*.json ./chainspecs/ +COPY --from=builder /build/target/production/node-subtensor /usr/local/bin/ +RUN chown subtensor:subtensor /usr/local/bin/node-subtensor + +COPY --from=builder /build/scripts/docker_entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh + +EXPOSE 30333 9933 9944 + +USER root +ENTRYPOINT ["/entrypoint.sh"] +CMD ["--base-path", "/data"]