-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (49 loc) · 2.37 KB
/
Makefile
File metadata and controls
61 lines (49 loc) · 2.37 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
.PHONY: build run test test-e2e test-playwright test-e2e-wallet test-wasm-prove validate clean wasm gen-circuits
PORT ?= 8088
build:
go build -o bitwrap ./cmd/bitwrap
wasm:
GOOS=js GOARCH=wasm go build -o public/prover.wasm ./cmd/prover-wasm
cp "$$(go env GOROOT)/lib/wasm/wasm_exec.js" public/wasm_exec.js
run: build
./bitwrap -port $(PORT)
test:
go test ./...
test-e2e:
go test -tags e2e -timeout 600s -v ./internal/server/ -run TestFoundryE2E
validate: build
./bitwrap -validate $(BTW)
test-playwright:
cd e2e && npm install --silent && npx playwright install chromium 2>/dev/null; cd e2e && npx playwright test
# Real-wallet e2e: boots the server with -dev -no-prover, runs Synpress+MetaMask
# tests, then tears the server down. Requires e2e/.env with TEST_SEED_PHRASE.
test-e2e-wallet: build
cd e2e && npm install --silent
@set -e ; \
./bitwrap -port $(PORT) -dev -no-prover & \
SERVER_PID=$$! ; \
trap "kill $$SERVER_PID 2>/dev/null || true" EXIT ; \
until curl -sf http://localhost:$(PORT)/ > /dev/null; do sleep 0.5; done ; \
cd e2e && npx playwright test --project=wallet
# Regenerate synthesized ZK circuits from the ERC templates. CI runs this
# and asserts `git diff --exit-code` so stale generated code fails the build.
# See prover/synth/ for the generator.
gen-circuits: build
./bitwrap -synthesize erc020 -output prover/erc020_gen.go
./bitwrap -synthesize erc05725 -output prover/erc05725_gen.go
./bitwrap -synthesize vote -output prover/vote_gen.go
# Regression check for issue #3 (gnark-crypto twisted-Edwards
# PointExtended.Add lazy-init bug). Builds wasm + native pk/vk for the
# v3 vote circuit and runs the wasm prover against the native bytes via
# the regular loadKeys path. The wasm prover applies the workaround
# (`_ = babyjubjub.GetEdwardsCurve()` at startup) so loadKeys+prove
# returns a real proof. Without that line — or without an upstream gnark-
# crypto fix — this fails with `constraint not satisfied` mid
# scalarMulFakeGLV. Requires a v3 witness dump at
# /tmp/v3-witness-dump.json (produced by `e2e/v3_dump_witness.spec.js`).
test-wasm-prove: wasm
NATIVE_EXPORT_CIRCUIT=voteCastHomomorphic_8 go test -timeout 600s -run TestNativeExportKeys -v ./prover
node public/wasm_load_native_diag.mjs voteCastHomomorphic_8
go test -timeout 120s -run TestLoadKeysOnlyProveSubprocess -v ./prover
clean:
rm -f bitwrap public/prover.wasm public/wasm_exec.js