Skip to content

Commit 2332c81

Browse files
Merge pull request #1 from unspecifiedcoder/production-build
feat: implement full production subnet build (all 13 phases)
2 parents b1f0829 + 2f67e5f commit 2332c81

109 files changed

Lines changed: 14960 additions & 210 deletions

File tree

Some content is hidden

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

.env.example

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# ── Bittensor ──
2+
NETUID=XX # Your subnet UID (assigned after registration)
3+
SUBTENSOR_NETWORK=finney # finney | test | local
4+
SUBTENSOR_CHAIN_ENDPOINT= # Custom endpoint (optional)
5+
6+
# ── Wallet ──
7+
WALLET_NAME=my_wallet
8+
WALLET_HOTKEY=default
9+
10+
# ── Miner ──
11+
MINER_BACKEND=openai # openai | anthropic | local | agent
12+
MINER_MODEL=gpt-4o # Model identifier
13+
OPENAI_API_KEY=sk-... # If using OpenAI backend
14+
ANTHROPIC_API_KEY=sk-ant-... # If using Anthropic backend
15+
MINER_PORT=8091
16+
MINER_MAX_CONCURRENT=4
17+
18+
# ── Validator ──
19+
VALIDATOR_PORT=8092
20+
VALIDATOR_EPOCH_LENGTH=360
21+
VALIDATOR_TASKS_PER_EPOCH=12
22+
VALIDATOR_TRAP_RATE=0.15
23+
VALIDATOR_TIMEOUT=300
24+
VALIDATOR_SANDBOX_ENABLED=true
25+
VALIDATOR_LEAN4_ENABLED=true
26+
VALIDATOR_EMBEDDING_MODEL=all-MiniLM-L6-v2
27+
28+
# ── Gateway ──
29+
GATEWAY_PORT=8000
30+
GATEWAY_API_KEY_SECRET=your-secret-key
31+
32+
# ── Monitoring ──
33+
PROMETHEUS_PORT=9090
34+
GRAFANA_PASSWORD=admin
35+
36+
# ── State ──
37+
STATE_DB_PATH=state/reasonforge.db

.github/workflows/build-docker.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Build Docker Images
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_PREFIX: ${{ github.repository_owner }}/reasonforge
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
18+
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
include:
23+
- image: miner
24+
dockerfile: docker/Dockerfile.miner
25+
- image: validator
26+
dockerfile: docker/Dockerfile.validator
27+
- image: gateway
28+
dockerfile: docker/Dockerfile.gateway
29+
- image: sandbox
30+
dockerfile: docker/Dockerfile.sandbox
31+
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@v4
35+
36+
- name: Set up Docker Buildx
37+
uses: docker/setup-buildx-action@v3
38+
39+
- name: Log in to Container Registry
40+
uses: docker/login-action@v3
41+
with:
42+
registry: ${{ env.REGISTRY }}
43+
username: ${{ github.actor }}
44+
password: ${{ secrets.GITHUB_TOKEN }}
45+
46+
- name: Extract metadata
47+
id: meta
48+
uses: docker/metadata-action@v5
49+
with:
50+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}-${{ matrix.image }}
51+
tags: |
52+
type=semver,pattern={{version}}
53+
type=semver,pattern={{major}}.{{minor}}
54+
type=sha
55+
56+
- name: Build and push
57+
uses: docker/build-push-action@v5
58+
with:
59+
context: .
60+
file: ${{ matrix.dockerfile }}
61+
push: true
62+
tags: ${{ steps.meta.outputs.tags }}
63+
labels: ${{ steps.meta.outputs.labels }}
64+
cache-from: type=gha
65+
cache-to: type=gha,mode=max

.github/workflows/lint.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
jobs:
10+
ruff:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Python 3.12
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.12"
20+
21+
- name: Install ruff
22+
run: pip install ruff
23+
24+
- name: Run ruff check
25+
run: ruff check .
26+
27+
- name: Run ruff format check
28+
run: ruff format --check .
29+
30+
mypy:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@v4
35+
36+
- name: Set up Python 3.12
37+
uses: actions/setup-python@v5
38+
with:
39+
python-version: "3.12"
40+
41+
- name: Cache pip dependencies
42+
uses: actions/cache@v4
43+
with:
44+
path: ~/.cache/pip
45+
key: ${{ runner.os }}-pip-mypy-${{ hashFiles('requirements*.txt') }}
46+
restore-keys: |
47+
${{ runner.os }}-pip-mypy-
48+
49+
- name: Install dependencies
50+
run: |
51+
python -m pip install --upgrade pip
52+
pip install -r requirements.txt
53+
pip install mypy
54+
55+
- name: Run mypy
56+
run: mypy reasonforge/ --ignore-missing-imports

.github/workflows/test.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
python-version: ["3.10", "3.11", "3.12"]
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Cache pip dependencies
27+
uses: actions/cache@v4
28+
with:
29+
path: ~/.cache/pip
30+
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements*.txt') }}
31+
restore-keys: |
32+
${{ runner.os }}-pip-${{ matrix.python-version }}-
33+
34+
- name: Install dependencies
35+
run: |
36+
python -m pip install --upgrade pip
37+
pip install -r requirements.txt
38+
pip install pytest pytest-cov pytest-asyncio
39+
40+
- name: Run tests
41+
run: |
42+
pytest tests/ -v --tb=short --cov=reasonforge --cov-report=xml --cov-report=term-missing
43+
44+
- name: Upload coverage
45+
if: matrix.python-version == '3.12'
46+
uses: actions/upload-artifact@v4
47+
with:
48+
name: coverage-report
49+
path: coverage.xml

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ build/
4545
# Simulation output
4646
simulation/*.json
4747

48+
# State (top-level state directory, not reasonforge/state/)
49+
/state/*.db
50+
/state/
51+
4852
# IDE
4953
.vscode/
5054
.idea/
55+
56+
# Docker
57+
docker/.env
58+
59+
# Wallets (never commit)
60+
.bittensor/

0 commit comments

Comments
 (0)