Skip to content

Commit adc7f4d

Browse files
authored
Merge pull request #1779 from opentensor/devnet
testnet merge 6/23/2025
2 parents 9fe45c5 + b783a3a commit adc7f4d

File tree

177 files changed

+26566
-16353
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

177 files changed

+26566
-16353
lines changed

.github/workflows/check-bittensor-e2e-tests.yml.yml

Lines changed: 38 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -10,49 +10,25 @@ concurrency:
1010

1111
on:
1212
pull_request:
13-
branches:
14-
- devnet
15-
- devnet-ready
16-
- testnet
17-
- testnet-ready
18-
- main
13+
branches: ["*"]
1914
types: [opened, synchronize, reopened, labeled, unlabeled]
2015

16+
workflow_dispatch:
17+
inputs:
18+
verbose:
19+
description: "Output more information when triggered manually"
20+
required: false
21+
default: ""
22+
2123
env:
2224
CARGO_TERM_COLOR: always
2325
VERBOSE: ${{ github.event.inputs.verbose }}
2426

2527
jobs:
26-
apply-label-to-new-pr:
27-
runs-on: ubuntu-latest
28-
if: ${{ github.event.pull_request.draft == false }}
29-
outputs:
30-
should_continue: ${{ steps.check.outputs.should_continue }}
31-
steps:
32-
- name: Check
33-
id: check
34-
run: |
35-
ACTION="${{ github.event.action }}"
36-
if [[ "$ACTION" == "opened" || "$ACTION" == "reopened" ]]; then
37-
echo "should_continue=true" >> $GITHUB_OUTPUT
38-
else
39-
echo "should_continue=false" >> $GITHUB_OUTPUT
40-
fi
41-
shell: bash
42-
43-
- name: Add label
44-
if: steps.check.outputs.should_continue == 'true'
45-
uses: actions-ecosystem/action-add-labels@v1
46-
with:
47-
github_token: ${{ secrets.GITHUB_TOKEN }}
48-
labels: run-bittensor-e2e-tests
49-
5028
check-label:
51-
needs: apply-label-to-new-pr
5229
runs-on: ubuntu-latest
53-
if: always()
5430
outputs:
55-
run-bittensor-e2e-tests: ${{ steps.get-labels.outputs.run-bittensor-e2e-tests }}
31+
skip-bittensor-e2e-tests: ${{ steps.get-labels.outputs.skip-bittensor-e2e-tests }}
5632
steps:
5733
- name: Check out repository
5834
uses: actions/checkout@v4
@@ -62,19 +38,17 @@ jobs:
6238
run: |
6339
LABELS=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name')
6440
echo "Current labels: $LABELS"
65-
if echo "$LABELS" | grep -q "run-bittensor-e2e-tests"; then
66-
echo "run-bittensor-e2e-tests=true" >> $GITHUB_ENV
67-
echo "::set-output name=run-bittensor-e2e-tests::true"
41+
if echo "$LABELS" | grep -q "skip-bittensor-e2e-tests"; then
42+
echo "skip-bittensor-e2e-tests=true" >> $GITHUB_OUTPUT
6843
else
69-
echo "run-bittensor-e2e-tests=false" >> $GITHUB_ENV
70-
echo "::set-output name=run-bittensor-e2e-tests::false"
44+
echo "skip-bittensor-e2e-tests=false" >> $GITHUB_OUTPUT
7145
fi
7246
env:
7347
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7448

7549
find-btcli-e2e-tests:
7650
needs: check-label
77-
if: always() && needs.check-label.outputs.run-bittensor-e2e-tests == 'true'
51+
if: needs.check-label.outputs.skip-bittensor-e2e-tests == 'false'
7852
runs-on: ubuntu-latest
7953
outputs:
8054
test-files: ${{ steps.get-btcli-tests.outputs.test-files }}
@@ -94,12 +68,12 @@ jobs:
9468
id: get-btcli-tests
9569
run: |
9670
test_files=$(find ${{ github.workspace }}/btcli/tests/e2e_tests -name "test*.py" | jq -R -s -c 'split("\n") | map(select(. != ""))')
97-
echo "::set-output name=test-files::$test_files"
71+
echo "test-files=$test_files" >> $GITHUB_OUTPUT
9872
shell: bash
9973

10074
find-sdk-e2e-tests:
10175
needs: check-label
102-
if: always() && needs.check-label.outputs.run-bittensor-e2e-tests == 'true'
76+
if: needs.check-label.outputs.skip-bittensor-e2e-tests == 'false'
10377
runs-on: ubuntu-latest
10478
outputs:
10579
test-files: ${{ steps.get-sdk-tests.outputs.test-files }}
@@ -119,7 +93,7 @@ jobs:
11993
id: get-sdk-tests
12094
run: |
12195
test_files=$(find ${{ github.workspace }}/bittensor/tests/e2e_tests -name "test*.py" | jq -R -s -c 'split("\n") | map(select(. != ""))')
122-
echo "::set-output name=test-files::$test_files"
96+
echo "test-files=$test_files" >> $GITHUB_OUTPUT
12397
shell: bash
12498

12599
build-image-with-current-branch:
@@ -128,6 +102,13 @@ jobs:
128102
steps:
129103
- name: Checkout code
130104
uses: actions/checkout@v4
105+
with:
106+
ref: ${{ github.head_ref }}
107+
108+
- name: Patch non-fast-block node
109+
run: |
110+
chmod +x ./scripts/localnet_patch.sh
111+
./scripts/localnet_patch.sh
131112
132113
- name: Set up QEMU
133114
uses: docker/setup-qemu-action@v3
@@ -153,7 +134,7 @@ jobs:
153134
- check-label
154135
- find-btcli-e2e-tests
155136
- build-image-with-current-branch
156-
if: always() && needs.check-label.outputs.run-bittensor-e2e-tests == 'true'
137+
if: needs.check-label.outputs.skip-bittensor-e2e-tests == 'false'
157138
runs-on: ubuntu-latest
158139
strategy:
159140
fail-fast: false
@@ -182,6 +163,8 @@ jobs:
182163

183164
- name: Install uv
184165
uses: astral-sh/setup-uv@v5
166+
with:
167+
enable-cache: 'false'
185168

186169
- name: Create Python virtual environment
187170
working-directory: ${{ github.workspace }}
@@ -201,10 +184,6 @@ jobs:
201184
uv run --active pip install '.[dev]'
202185
uv run --active pip install pytest
203186
204-
- name: Install uv dependencies
205-
working-directory: ${{ github.workspace }}/btcli
206-
run: uv sync --all-extras --dev
207-
208187
- name: Download Cached Docker Image
209188
uses: actions/download-artifact@v4
210189
with:
@@ -213,6 +192,9 @@ jobs:
213192
- name: Load Docker Image
214193
run: docker load -i subtensor-localnet.tar
215194

195+
- name: Retag Docker Image
196+
run: docker tag localnet ghcr.io/opentensor/subtensor-localnet:devnet-ready
197+
216198
# - name: Run tests
217199
# working-directory: ${{ github.workspace }}/btcli
218200
# run: |
@@ -223,6 +205,7 @@ jobs:
223205
working-directory: ${{ github.workspace }}/btcli
224206
run: |
225207
source ${{ github.workspace }}/venv/bin/activate
208+
export SKIP_PULL=1
226209
set +e
227210
for i in 1 2; do
228211
echo "🔁 Attempt $i: Running tests"
@@ -248,7 +231,7 @@ jobs:
248231
- check-label
249232
- find-sdk-e2e-tests
250233
- build-image-with-current-branch
251-
if: always() && needs.check-label.outputs.run-bittensor-e2e-tests == 'true'
234+
if: needs.check-label.outputs.skip-bittensor-e2e-tests == 'false'
252235
runs-on: ubuntu-latest
253236
strategy:
254237
fail-fast: false
@@ -277,6 +260,8 @@ jobs:
277260

278261
- name: Install uv
279262
uses: astral-sh/setup-uv@v5
263+
with:
264+
enable-cache: 'false'
280265

281266
- name: Create Python virtual environment
282267
working-directory: ${{ github.workspace }}
@@ -296,10 +281,6 @@ jobs:
296281
uv run --active pip install '.[dev]'
297282
uv run --active pip install pytest
298283
299-
- name: Install uv dependencies
300-
working-directory: ${{ github.workspace }}/bittensor
301-
run: uv sync --all-extras --dev
302-
303284
- name: Download Cached Docker Image
304285
uses: actions/download-artifact@v4
305286
with:
@@ -308,6 +289,9 @@ jobs:
308289
- name: Load Docker Image
309290
run: docker load -i subtensor-localnet.tar
310291

292+
- name: Retag Docker Image
293+
run: docker tag localnet ghcr.io/opentensor/subtensor-localnet:devnet-ready
294+
311295
# - name: Run tests
312296
# working-directory: ${{ github.workspace }}/bittensor
313297
# run: |
@@ -318,6 +302,7 @@ jobs:
318302
working-directory: ${{ github.workspace }}/bittensor
319303
run: |
320304
source ${{ github.workspace }}/venv/bin/activate
305+
export SKIP_PULL=1
321306
set +e
322307
for i in 1 2; do
323308
echo "🔁 Attempt $i: Running tests"
@@ -335,4 +320,4 @@ jobs:
335320
echo "🕒 Retrying..."
336321
sleep 5
337322
fi
338-
done
323+
done

.github/workflows/require-clean-merges.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ jobs:
3434
else
3535
echo "MERGE_BRANCHES=devnet-ready devnet testnet main" >> $GITHUB_ENV
3636
fi
37+
38+
- name: Add Fork Remote and Fetch PR Branch
39+
if: github.event.pull_request.head.repo.fork == true
40+
run: |
41+
PR_BRANCH="${{ github.event.pull_request.head.ref }}"
42+
PR_FORK="${{ github.event.pull_request.head.repo.clone_url }}"
43+
git remote add fork $PR_FORK
44+
git fetch --no-tags --prune fork $PR_BRANCH
3745
3846
- name: Check Merge Cleanliness
3947
run: |
@@ -42,25 +50,33 @@ jobs:
4250
echo "Fetching all branches..."
4351
git fetch --all --prune
4452
53+
if [[ "${{github.event.pull_request.head.repo.fork}}" == "true" ]]; then
54+
PR_BRANCH_REF="fork/$PR_BRANCH"
55+
echo "Using fork reference: $PR_BRANCH_REF"
56+
else
57+
PR_BRANCH_REF="origin/$PR_BRANCH"
58+
echo "Using origin reference: $PR_BRANCH_REF"
59+
fi
60+
4561
echo "Checking out PR branch: $PR_BRANCH"
46-
git checkout $PR_BRANCH
47-
git reset --hard origin/$PR_BRANCH
62+
git checkout $PR_BRANCH_REF
63+
git reset --hard $PR_BRANCH_REF
4864
4965
# Configure a temporary Git identity to allow merging
5066
git config --local user.email "github-actions@github.com"
5167
git config --local user.name "GitHub Actions"
5268
5369
for branch in $MERGE_BRANCHES; do
54-
echo "Checking merge from $branch into $PR_BRANCH..."
70+
echo "Checking merge from $branch into $PR_BRANCH_REF..."
5571
5672
# Ensure PR branch is up to date
57-
git reset --hard origin/$PR_BRANCH
73+
git reset --hard $PR_BRANCH_REF
5874
5975
# Merge without committing to check for conflicts
6076
if git merge --no-commit --no-ff origin/$branch; then
61-
echo "✅ Merge from $branch into $PR_BRANCH is clean."
77+
echo "✅ Merge from $branch into $PR_BRANCH_REF is clean."
6278
else
63-
echo "❌ Merge conflict detected when merging $branch into $PR_BRANCH"
79+
echo "❌ Merge conflict detected when merging $branch into $PR_BRANCH_REF"
6480
exit 1
6581
fi
6682

.github/workflows/run-benchmarks.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,20 @@ jobs:
2424
if: ${{ env.SKIP_BENCHMARKS != '1' }}
2525
uses: actions/checkout@v4
2626
with:
27-
ref: ${{ github.head_ref }}
27+
repository: ${{ github.event.pull_request.head.repo.full_name }}
28+
ref: ${{ github.event.pull_request.head.ref }}
2829
fetch-depth: 0
2930

3031
- name: Install GitHub CLI
31-
if: ${{ env.SKIP_BENCHMARKS != '1' }}
32+
# We disallow skipping benchmarks for PRs from forks to avoid exposing secrets
33+
if: ${{ github.event.pull_request.head.repo.full_name == github.repository && env.SKIP_BENCHMARKS != '1' }}
3234
run: |
3335
sudo apt-get update
3436
sudo apt-get install -y gh
3537
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
3638
3739
- name: Check skip label
38-
if: ${{ env.SKIP_BENCHMARKS != '1' }}
40+
if: ${{ github.event.pull_request.head.repo.full_name == github.repository && env.SKIP_BENCHMARKS != '1' }}
3941
run: |
4042
labels=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name')
4143
if echo "$labels" | grep -q "skip-validate-benchmarks"; then
@@ -50,7 +52,7 @@ jobs:
5052
sudo apt-get install -y clang curl libssl-dev llvm libudev-dev protobuf-compiler
5153
5254
- name: Check skip label
53-
if: ${{ env.SKIP_BENCHMARKS != '1' }}
55+
if: ${{ github.event.pull_request.head.repo.full_name == github.repository && env.SKIP_BENCHMARKS != '1' }}
5456
run: |
5557
labels=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name')
5658
if echo "$labels" | grep -q "skip-validate-benchmarks"; then
@@ -66,7 +68,7 @@ jobs:
6668
toolchain: stable
6769

6870
- name: Check skip label
69-
if: ${{ env.SKIP_BENCHMARKS != '1' }}
71+
if: ${{ github.event.pull_request.head.repo.full_name == github.repository && env.SKIP_BENCHMARKS != '1' }}
7072
run: |
7173
labels=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name')
7274
if echo "$labels" | grep -q "skip-validate-benchmarks"; then
@@ -81,7 +83,7 @@ jobs:
8183
key: bench-${{ hashFiles('**/Cargo.lock') }}
8284

8385
- name: Check skip label
84-
if: ${{ env.SKIP_BENCHMARKS != '1' }}
86+
if: ${{ github.event.pull_request.head.repo.full_name == github.repository && env.SKIP_BENCHMARKS != '1' }}
8587
run: |
8688
labels=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name')
8789
if echo "$labels" | grep -q "skip-validate-benchmarks"; then
@@ -95,7 +97,7 @@ jobs:
9597
cargo build --profile production -p node-subtensor --features runtime-benchmarks
9698
9799
- name: Check skip label
98-
if: ${{ env.SKIP_BENCHMARKS != '1' }}
100+
if: ${{ github.event.pull_request.head.repo.full_name == github.repository && env.SKIP_BENCHMARKS != '1' }}
99101
run: |
100102
labels=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name')
101103
if echo "$labels" | grep -q "skip-validate-benchmarks"; then
@@ -110,7 +112,7 @@ jobs:
110112
./scripts/benchmark_action.sh
111113
112114
- name: Check skip label after run
113-
if: ${{ env.SKIP_BENCHMARKS != '1' }}
115+
if: ${{ github.event.pull_request.head.repo.full_name == github.repository && env.SKIP_BENCHMARKS != '1' }}
114116
run: |
115117
labels=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name')
116118
if echo "$labels" | grep -q "skip-validate-benchmarks"; then

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
**/*.rs.bk
66

77
**/*.lock
8+
!evm-tests/yarn.lock
89

910
*.ipynb
1011

0 commit comments

Comments
 (0)