.PHONY: install test probe conformance fidelity consensus all clean live

install:
	uv venv --python 3.12 2>/dev/null || true
	. .venv/bin/activate && uv pip install -e ".[chain,dev]"

test:
	. .venv/bin/activate && python -m pytest -q

probe:
	@. .venv/bin/activate && \
	for m in naive_flat quality_only hardened winner_take_all; do \
	  echo ""; echo "=============== $$m ==============="; \
	  assay run examples/$$m.py --no-color || true; \
	done

conformance:
	. .venv/bin/activate && assay conformance

# validator-side: consensus, stake capture, concentration
consensus:
	@. .venv/bin/activate && \
	for m in hardened winner_take_all; do \
	  echo ""; echo "=============== $$m ==============="; \
	  assay consensus examples/$$m.py --no-color || true; \
	done

# verify the weights-into-rewards model against the chain
fidelity:
	. .venv/bin/activate && assay fidelity --netuid 64

# what CI runs
all: test conformance
	@. .venv/bin/activate && assay run examples/hardened.py -f json -o assay.json \
	  && echo "gate: hardened mechanism still holds"

# live replay needs network + the chain extra
live:
	@. .venv/bin/activate && \
	for n in 1 4 8 64; do assay live --netuid $$n --no-color || true; done

clean:
	rm -rf .pytest_cache assay.json
	find . -name __pycache__ -type d -prune -exec rm -rf {} +
