upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYour Name <you@example.com>2026-05-21 17:07:41 +0530
committerYour Name <you@example.com>2026-05-21 17:07:41 +0530
commit4b1afa4ec98386d55ee5ba9e1a42d470a75ff088 (patch)
tree902e50fbe8c9b9514677ffd612509fa4340d04e3
parent19e175b1c1dea54efb61e8040ffdfa973fbac5d5 (diff)
docs: add Phase 10 wallet-via-health-task plan with checklist
-rw-r--r--PLAN.md47
1 files changed, 47 insertions, 0 deletions
diff --git a/PLAN.md b/PLAN.md
index be9e3ce..4822f1d 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -934,3 +934,50 @@ In `physical-router-test-automation/`:
934 934
935- Implement negentropy binary protocol (NIP-77 NEG_OPEN/NEG_MSG) for efficient set-reconciliation sync 935- Implement negentropy binary protocol (NIP-77 NEG_OPEN/NEG_MSG) for efficient set-reconciliation sync
936- NIP-11 returns JSON without Accept header (minor: should return HTML) 936- NIP-11 returns JSON without Accept header (minor: should return HTML)
937
938## Phase 10: Wallet Receive via Health Task Queue — IN PROGRESS
939
940**Goal:** Reliable wallet receive on ESP32 by reusing the mint health task's TLS context. Eliminates internal RAM fragmentation that prevented standalone TLS worker creation.
941
942### Problem Solved
943
944The original approach (standalone `tls_worker` task) failed because:
945- ESP32-S3 internal RAM is ~25KB free at boot after httpd (16KB) + health (16KB) tasks
946- Largest contiguous block after those two tasks: ~10-14KB — insufficient for a 16KB TLS stack
947- PSRAM stack crashes on NVS writes: `esp_task_stack_is_sane_cache_disabled()` assertion in `spi_flash`
948
949### Solution
950
951Wallet receive operations are submitted to a FreeRTOS queue processed by the **mint health task** (already has 16KB stack + working TLS). Health task polls the queue every 1s between probe intervals.
952
953### Files Changed
954
955| File | Change |
956|------|--------|
957| `main/tollgate_api.c` | Removed `tls_worker_task`/`tls_worker_start`, added `tls_worker_set_queue()` + queue-based `tls_worker_submit()` |
958| `main/tollgate_api.h` | Replaced `tls_worker_start()` with `tls_worker_set_queue()` |
959| `main/mint_health.c` | Added wallet queue, `process_wallet_queue()`, integrated into `health_task()` main loop |
960| `main/tollgate_main.c` | Removed `tls_worker_start()` call |
961| `tests/unit/stubs/freertos/queue.h` | New: FreeRTOS queue stub for host tests |
962| `tests/unit/stubs/freertos/FreeRTOS.h` | Added `BaseType_t`, `UBaseType_t`, `TickType_t`, `pdFALSE` |
963| `tests/unit/stubs/tollgate_api.h` | New: `tls_worker_set_queue()` stub |
964| `tests/unit/test_mint_health.c` | Added stub implementations for `nucula_wallet_receive`, `nucula_wallet_balance`, `tls_worker_set_queue` |
965
966### Checklist
967
968- [x] Remove standalone TLS worker task
969- [x] Add wallet queue to mint_health task
970- [x] Health task polls queue every 1s
971- [x] Fallback to synchronous receive if queue unavailable
972- [x] Unit tests pass (16/16)
973- [x] Full payment round-trip confirmed (2 payments -> 41 sat)
974- [x] Smoke integration test (6/6)
975- [ ] Fix 4 failing API integration tests
976- [ ] Test spend from funded wallet
977- [ ] Flash Board C with wallet fix
978- [ ] Cross-board integration test
979- [ ] Playwright E2E captive portal test
980- [ ] CVM round-trip test
981- [ ] Reliability burst test (5-10 rapid payments)
982- [ ] Persistence survives reboot
983- [ ] Wallet swap endpoint test