diff options
Diffstat (limited to 'CHECKLIST.md')
| -rw-r--r-- | CHECKLIST.md | 89 |
1 files changed, 45 insertions, 44 deletions
diff --git a/CHECKLIST.md b/CHECKLIST.md index fe5894f..ba17adc 100644 --- a/CHECKLIST.md +++ b/CHECKLIST.md | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | # TollGate ESP32 — Progress Checklist | 1 | # TollGate ESP32 — Progress Checklist |
| 2 | 2 | ||
| 3 | ## Phase 0: Bootstrap | 3 | ## Phase 0: Bootstrap — COMPLETE |
| 4 | - [x] Create project directory and git repo | 4 | - [x] Create project directory and git repo |
| 5 | - [x] Create .env, .env.example, .gitignore | 5 | - [x] Create .env, .env.example, .gitignore |
| 6 | - [x] Persist PLAN.md and CHECKLIST.md | 6 | - [x] Persist PLAN.md and CHECKLIST.md |
| @@ -9,66 +9,67 @@ | |||
| 9 | - [x] Run `make detect-all` — identified both boards as ESP32-S3 (16MB flash) | 9 | - [x] Run `make detect-all` — identified both boards as ESP32-S3 (16MB flash) |
| 10 | - [x] Fix ESP-IDF v5.4.1 installation (was deeply corrupted, re-cloned) | 10 | - [x] Fix ESP-IDF v5.4.1 installation (was deeply corrupted, re-cloned) |
| 11 | 11 | ||
| 12 | ## Phase 1: Captive Portal + Firewall — COMPLETE | 12 | ## Phase 1: Captive Portal + Firewall — COMPLETE (commit `a7d0a67`) |
| 13 | - [x] Implement tollgate_main.c (WiFi AP+STA, event loop) | 13 | - [x] Implement tollgate_main.c (WiFi AP+STA, event loop) |
| 14 | - [x] Implement config.c/h (SPIFFS JSON config loading) | 14 | - [x] Implement config.c/h (SPIFFS JSON config loading) |
| 15 | - [x] Implement dns_server.c/h (DNS hijack/forward per-client) | 15 | - [x] Implement dns_server.c/h (DNS hijack/forward per-client) |
| 16 | - [x] Implement captive_portal.c/h (HTTP :80, portal HTML) | 16 | - [x] Implement captive_portal.c/h (HTTP :80, portal HTML) |
| 17 | - [x] Implement firewall.c/h (NAPT on/off per auth state) | 17 | - [x] Implement firewall.c/h (NAPT on/off per auth state) |
| 18 | - [x] Set up test infrastructure (Node.js tests, helpers, Playwright) | 18 | - [x] Set up test infrastructure (Node.js tests, helpers, Playwright) |
| 19 | - [x] Fix WiFi init order bug (netif before esp_wifi_init, set_mode before set_config) | 19 | - [x] Fix WiFi init order bug |
| 20 | - [x] Fix DNS hijack test (nslookup exits 1 for AAAA, catch stderr) | 20 | - [x] Fix DNS hijack test (nslookup exits 1 for AAAA) |
| 21 | - [x] Fix ping tests (use `-I wlp59s0` to force through TollGate AP) | 21 | - [x] Fix ping tests (use `-I wlp59s0`) |
| 22 | - [x] Test 1: Boot and AP appears | 22 | - [x] Tests 1-14: ALL PASSING |
| 23 | - [x] Test 2: DHCP lease | ||
| 24 | - [x] Test 3: Captive portal serves HTML | ||
| 25 | - [x] Test 4: Captive detection URIs work (8 URIs) | ||
| 26 | - [x] Test 5: DNS hijack before auth | ||
| 27 | - [x] Test 6: No internet before auth | ||
| 28 | - [x] Test 7: /whoami returns MAC | ||
| 29 | - [x] Test 8: /usage returns no session | ||
| 30 | - [x] Test 9: Grant access via API | ||
| 31 | - [x] Test 10: DNS forward after auth | ||
| 32 | - [x] Test 11: Internet after auth | ||
| 33 | - [x] Test 12: HTTP browsing works | ||
| 34 | - [x] Test 13: Reset auth | ||
| 35 | - [x] Test 14: Internet blocked after reset | ||
| 36 | - [x] **All 20 API tests pass, all 6 smoke tests pass** | ||
| 37 | - [x] Committed: `a7d0a67` | ||
| 38 | 23 | ||
| 39 | ## Phase 2: E-Cash Payments — IN PROGRESS (code written, bugs to fix) | 24 | ## Phase 2: E-Cash Payments — IN PROGRESS |
| 25 | ### Code Written (commit `1263d86`) | ||
| 40 | - [x] Implement cashu.c/h (Cashu token parse, base64url, checkstate, mint validation) | 26 | - [x] Implement cashu.c/h (Cashu token parse, base64url, checkstate, mint validation) |
| 41 | - [x] Implement session.c/h (time-based allotment, expiry, secret tracking) | 27 | - [x] Implement session.c/h (time-based allotment, expiry, secret tracking) |
| 42 | - [x] Implement tollgate_api.c/h (:2121 server, GET/POST /, /usage, /whoami) | 28 | - [x] Implement tollgate_api.c/h (:2121 server, GET/POST /, /usage, /whoami) |
| 43 | - [x] Update captive portal HTML with payment form (token textarea, Pay & Connect button) | 29 | - [x] Update captive portal HTML with payment form |
| 44 | - [x] Wire into tollgate_main.c (session_init, api_start, session_tick loop) | 30 | - [x] Wire into tollgate_main.c (session_init, api_start, session_tick loop) |
| 31 | |||
| 32 | ### Bug Fixes (commit `aed51d8`) | ||
| 33 | - [x] Stack overflow: httpd stack_size increased to 16384 in tollgate_api.c | ||
| 34 | - [x] Heap allocations: b64, json_buf, post_body, resp_buf moved to heap in cashu.c | ||
| 35 | - [x] .env: MINT_URL updated to testnut.cashu.space | ||
| 36 | - [x] Makefile: replaced Go-based tokens target with nutshell wallet targets | ||
| 37 | |||
| 38 | ### Infrastructure (ready now) | ||
| 39 | - [x] Upstream gateway on enx00e04c633a90 (192.168.2.0/24, metric 101, default route) | ||
| 40 | - [x] OpenWRT TollGate on enx00e04c683d2d (10.47.41.0/24, metric 20100, never-default) | ||
| 41 | - [x] WiFi wlp59s0 free for ESP32 TollGate connection | ||
| 42 | - [x] NetworkManager profile "TollGate-ESP32" created (manual 192.168.4.2/24, autoconnect=no) | ||
| 43 | |||
| 44 | ### Tests Passing | ||
| 45 | - [x] Test 15: Advertisement valid (kind=10021 with price_per_step) — PASSING | 45 | - [x] Test 15: Advertisement valid (kind=10021 with price_per_step) — PASSING |
| 46 | - [ ] **BUG FIX: Stack overflow in httpd task** — POST to :2121 crashes (Guru Meditation LoadProhibited). Need to increase httpd stack_size to 16384 and heap-allocate large buffers in cashu.c | 46 | |
| 47 | - [ ] **BUG FIX: cashu_decode_token has 2048B stack buffer** — move json_buf to heap | 47 | ### Tests Blocked (need hardware flash + test) |
| 48 | - [ ] **BUG FIX: cashu_check_proof_states has 4096B stack buffer** — move resp_buf to heap | 48 | - [ ] Test 16: Valid payment (POST :2121/ with valid Cashu token → kind=1022 session) |
| 49 | - [ ] Test 16: Valid payment (needs valid Cashu token from nutshell) | 49 | - [ ] Test 17: Usage tracking after payment (GET :2121/usage → active usage) |
| 50 | - [ ] Test 17: Usage tracking after payment | 50 | - [ ] Test 18: Internet after payment (ping through TollGate works) |
| 51 | - [ ] Test 18: Internet after payment | 51 | - [ ] Test 19: Invalid token rejected (POST garbage → 400, kind=21023) |
| 52 | - [ ] Test 19: Invalid token rejected — blocked by stack overflow crash | 52 | - [ ] Test 20: Spent token rejected (reuse token → 402, kind=21023) |
| 53 | - [ ] Test 20: Spent token rejected | 53 | - [ ] Test 21: Wrong mint rejected (POST token from wrong mint → 402) |
| 54 | - [ ] Test 21: Wrong mint rejected — blocked by stack overflow crash | 54 | - [ ] Test 22: Session expiry (wait for allotment → internet blocked) |
| 55 | - [ ] Test 22: Session expiry | 55 | - [ ] Test 23: Session renewal (second payment → allotment extended) |
| 56 | - [ ] Test 23: Session renewal | 56 | - [ ] Test 24: Portal payment form visible in browser |
| 57 | - [ ] Test 24: Portal payment form — blocked by stack overflow crash | ||
| 58 | - [ ] Test 25: Two clients pay independently | 57 | - [ ] Test 25: Two clients pay independently |
| 59 | - [ ] Test 26: Client isolation | 58 | - [ ] Test 26: Client isolation (only payer gets internet) |
| 60 | - [ ] Test 27: Full e2e browser flow | 59 | - [ ] Test 27: Full e2e: portal → pay → browse |
| 61 | 60 | ||
| 62 | ## Infrastructure Setup — TODO (before next hardware session) | 61 | ### Next Steps (TDD cycle) |
| 63 | - [ ] Update .env: change mint from nofee.testnut.cashu.space → testnut.cashu.space | 62 | 1. Flash firmware to ESP32 board A (`make flash-a`) |
| 64 | - [ ] Update Makefile: add nutshell wallet targets (mint-token, send-token, balance) | 63 | 2. Connect WiFi to TollGate AP: `nmcli con up TollGate-ESP32` |
| 65 | - [ ] Create Ansible playbook for full dev environment setup | 64 | 3. Run Phase 2 discovery test: `TOLLGATE_IP=192.168.4.1 node tests/phase2.mjs` |
| 66 | - [ ] Create NetworkManager profile for TollGate testing (ethernet=upstream, wifi=tollgate only) | 65 | 4. If Test 15 still passes, proceed to Test 19 (invalid token — no mint needed) |
| 67 | - [ ] Verify network routing works (ethernet default route, WiFi 192.168.4.0/24 only) | 66 | 5. Mint a test token: `make mint-token AMOUNT=21` |
| 67 | 6. Run full Phase 2 with token: `TEST_TOKEN=$(cashu --env-mint testnut.cashu.space send --legacy 21) TOLLGATE_IP=192.168.4.1 node tests/phase2.mjs` | ||
| 68 | 7. Fix any failures, commit + push when tests pass | ||
| 68 | 69 | ||
| 69 | ## Phase 3: nucula Wallet + Reseller — NOT STARTED | 70 | ## Phase 3: nucula Wallet + Reseller — NOT STARTED |
| 70 | - [ ] Extract nucula wallet into components/cashu_wallet/ | 71 | - [ ] Extract nucula wallet into components/cashu_wallet/ |
| 71 | - [ ] Replace simple melt with Wallet::receive() | 72 | - [ ] Replace simple melt with Wallet::receive() |
| 72 | - [ ] Implement payout.c/h (background melt-to-LN) | 73 | - [ ] Implement payout.c/h (background melt-to-LN) |
| 73 | - [ ] Implement upstream_client.c/h (reseller mode) | 74 | - [ ] Implement upstream_client.c/h (reseller mode) |
| 74 | - [ ] Test 28-38: All Phase 3 tests | 75 | - [ ] Tests 28-38 |