Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# ── Bittensor ──
NETUID=XX # Your subnet UID (assigned after registration)
SUBTENSOR_NETWORK=finney # finney | test | local
SUBTENSOR_CHAIN_ENDPOINT= # Custom endpoint (optional)

# ── Wallet ──
WALLET_NAME=my_wallet
WALLET_HOTKEY=default

# ── Miner ──
MINER_BACKEND=openai # openai | anthropic | local | agent
MINER_MODEL=gpt-4o # Model identifier
OPENAI_API_KEY=sk-... # If using OpenAI backend
ANTHROPIC_API_KEY=sk-ant-... # If using Anthropic backend
MINER_PORT=8091
MINER_MAX_CONCURRENT=4

# ── Validator ──
VALIDATOR_PORT=8092
VALIDATOR_EPOCH_LENGTH=360
VALIDATOR_TASKS_PER_EPOCH=12
VALIDATOR_TRAP_RATE=0.15
VALIDATOR_TIMEOUT=300
VALIDATOR_SANDBOX_ENABLED=true
VALIDATOR_LEAN4_ENABLED=true
VALIDATOR_EMBEDDING_MODEL=all-MiniLM-L6-v2

# ── Gateway ──
GATEWAY_PORT=8000
GATEWAY_API_KEY_SECRET=your-secret-key

# ── Monitoring ──
PROMETHEUS_PORT=9090
GRAFANA_PASSWORD=admin

# ── State ──
STATE_DB_PATH=state/reasonforge.db
65 changes: 65 additions & 0 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build Docker Images

on:
push:
tags:
- "v*"

env:
REGISTRY: ghcr.io
IMAGE_PREFIX: ${{ github.repository_owner }}/reasonforge

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

strategy:
fail-fast: false
matrix:
include:
- image: miner
dockerfile: docker/Dockerfile.miner
- image: validator
dockerfile: docker/Dockerfile.validator
- image: gateway
dockerfile: docker/Dockerfile.gateway
- image: sandbox
dockerfile: docker/Dockerfile.sandbox

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}-${{ matrix.image }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ${{ matrix.dockerfile }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
56 changes: 56 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Lint

on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]

jobs:
ruff:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install ruff
run: pip install ruff

- name: Run ruff check
run: ruff check .

- name: Run ruff format check
run: ruff format --check .

mypy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Cache pip dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-mypy-${{ hashFiles('requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-mypy-

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install mypy

- name: Run mypy
run: mypy reasonforge/ --ignore-missing-imports
49 changes: 49 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Tests

on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Cache pip dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov pytest-asyncio

- name: Run tests
run: |
pytest tests/ -v --tb=short --cov=reasonforge --cov-report=xml --cov-report=term-missing

- name: Upload coverage
if: matrix.python-version == '3.12'
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage.xml
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ build/
# Simulation output
simulation/*.json

# State (top-level state directory, not reasonforge/state/)
/state/*.db
/state/

# IDE
.vscode/
.idea/

# Docker
docker/.env

# Wallets (never commit)
.bittensor/
Loading