-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
95 lines (66 loc) · 4.1 KB
/
Copy pathMakefile
File metadata and controls
95 lines (66 loc) · 4.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
.PHONY: build test test-sol test-noir test-sdk test-xochi-sdk test-all fmt fmt-check lint slither snapshot benchmark fixtures check-toolchain parity-check clean help
FOUNDRY_BIN := $(HOME)/.config/.foundry/bin
FORGE := $(FOUNDRY_BIN)/forge
NARGO := nargo
CIRCUITS := compliance risk_score pattern attestation membership non_membership
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
# ── Build ────────────────────────────────────────────────────
build: build-sol build-noir ## Build everything
build-sol: ## Compile Solidity contracts
$(FORGE) build
build-noir: ## Compile all Noir circuits
cd circuits && $(NARGO) compile --workspace
# ── Test ─────────────────────────────────────────────────────
test: test-sol ## Run Solidity tests (default)
test-sol: ## Run Solidity tests (forge test)
$(FORGE) test
test-sol-v: ## Run Solidity tests verbose
$(FORGE) test -vvv
test-noir: ## Run all Noir circuit tests
cd circuits && $(NARGO) test --workspace
test-sdk: ## Run TS consumer SDK tests (noir_js + bb.js + anvil)
npm run test:sdk
test-xochi-sdk: ## Run @xochi/sdk cross-repo tests (requires ../xochi-sdk)
npx vitest run --config vitest.cross-repo.config.ts
test-all: test-sol test-noir test-sdk ## Run all tests
coverage: ## Run forge coverage (summary report; excludes generated/test/script)
@# Skip ratchet + MAX_BATCH_SIZE gas tests: under --ir-minimum gas inflates
@# and warp ordering shifts, so these become non-deterministic.
$(FORGE) coverage \
--ir-minimum \
--no-match-test "test_ratchet_acceptsForwardProgression|test_ratchet_rejectsOlderProof|test_ratchet_rejectsBackwardEvenWithinMaxAge|test_ratchet_separateJurisdictions_independent|test_ratchet_separateUsers_independent|test_gas_batch_atMaxSize_fitsBlockGasTarget" \
--report summary
coverage-lcov: ## Run forge coverage and emit lcov.info
$(FORGE) coverage \
--ir-minimum \
--no-match-test "test_ratchet_acceptsForwardProgression|test_ratchet_rejectsOlderProof|test_ratchet_rejectsBackwardEvenWithinMaxAge|test_ratchet_separateJurisdictions_independent|test_ratchet_separateUsers_independent|test_gas_batch_atMaxSize_fitsBlockGasTarget" \
--report lcov
# ── Formatting & Lint ────────────────────────────────────────
fmt: ## Format Solidity sources
$(FORGE) fmt
fmt-check: ## Check Solidity formatting (CI)
$(FORGE) fmt --check
lint: fmt-check ## Lint (currently fmt-check only)
slither: ## Run Slither static analysis (requires slither-analyzer)
@mv src/generated /tmp/erc8262-generated-backup 2>/dev/null || true
@slither . || (mv /tmp/erc8262-generated-backup src/generated 2>/dev/null; exit 1)
@mv /tmp/erc8262-generated-backup src/generated 2>/dev/null || true
# ── Fixtures & Gas ───────────────────────────────────────────
check-toolchain: ## Verify pinned nargo + bb versions match .tool-versions
./scripts/check-toolchain.sh
parity-check: ## Verify circuit <-> Solidity public-input arity parity (audit F-8)
python3 scripts/parity-check.py .
fixtures: check-toolchain ## Generate proof fixtures for all circuits
./scripts/generate-fixtures.sh
snapshot: ## Capture gas snapshot (deterministic tests only; fuzz/invariant excluded)
FOUNDRY_PROFILE=default $(FORGE) snapshot --no-match-contract InvariantTest --no-match-test "testFuzz_"
benchmark: ## Run gas benchmarks with report
$(FORGE) test --match-contract GasBenchmark -vvv --gas-report
# ── Clean ────────────────────────────────────────────────────
clean: ## Remove build artifacts
$(FORGE) clean
rm -rf node_modules
@for c in $(CIRCUITS); do \
rm -rf circuits/$$c/target; \
done