<feed xmlns='http://www.w3.org/2005/Atom'>
<title>npub12m5exm2uk3xa674cc5r0hlyvccs5xxn7qv83ezuteefv5972nquq4j4szl/esp32-tollgate/tests/unit/Makefile, branch feature/mining-payment</title>
<subtitle>[no description]</subtitle>
<id>https://upleb.uk/npub12m5exm2uk3xa674cc5r0hlyvccs5xxn7qv83ezuteefv5972nquq4j4szl/esp32-tollgate/atom?h=feature%2Fmining-payment</id>
<link rel='self' href='https://upleb.uk/npub12m5exm2uk3xa674cc5r0hlyvccs5xxn7qv83ezuteefv5972nquq4j4szl/esp32-tollgate/atom?h=feature%2Fmining-payment'/>
<link rel='alternate' type='text/html' href='https://upleb.uk/npub12m5exm2uk3xa674cc5r0hlyvccs5xxn7qv83ezuteefv5972nquq4j4szl/esp32-tollgate/'/>
<updated>2026-05-19T07:40:54+00:00</updated>
<entry>
<title>test: add 4 new unit test suites for mining modules</title>
<updated>2026-05-19T07:40:54+00:00</updated>
<author>
<name>Your Name</name>
<email>you@example.com</email>
</author>
<published>2026-05-19T07:40:54+00:00</published>
<link rel='alternate' type='text/html' href='https://upleb.uk/npub12m5exm2uk3xa674cc5r0hlyvccs5xxn7qv83ezuteefv5972nquq4j4szl/esp32-tollgate/commit/?id=ef9ae982e42cd8c719a8ba5a0b87f25a5a5f91ba'/>
<id>urn:sha1:ef9ae982e42cd8c719a8ba5a0b87f25a5a5f91ba</id>
<content type='text'>
- test_stratum_proxy: job set/get, stats, init (21 tests)
- test_session_payment_method: PAYMENT_METHOD enum, bytes/cashu methods (12 tests)
- test_tollgate_client_mining: mining tag parsing, discovery struct (20 tests)
- test_firewall_sandbox: client management, grant/revoke, max clients (16 tests)
- Enhanced stubs: BaseType_t/pdPASS in task.h, lwip sockets/etharp/prot headers,
  dns_server.h, esp_wifi_ap_get_sta_list.h
- All 15 test suites pass (344+ total assertions)
</content>
</entry>
<entry>
<title>feat(mining): add new mining source files and unit tests</title>
<updated>2026-05-18T22:37:16+00:00</updated>
<author>
<name>Your Name</name>
<email>you@example.com</email>
</author>
<published>2026-05-18T22:37:16+00:00</published>
<link rel='alternate' type='text/html' href='https://upleb.uk/npub12m5exm2uk3xa674cc5r0hlyvccs5xxn7qv83ezuteefv5972nquq4j4szl/esp32-tollgate/commit/?id=c75230e551a778408b2e370b208aff76b74c6560'/>
<id>urn:sha1:c75230e551a778408b2e370b208aff76b74c6560</id>
<content type='text'>
- mining_payment.c/h: hashprice calc, share validation, per-client hashrate
- stratum_client.c/h: SV1 upstream pool connection
- stratum_proxy.c/h: local SV1 TCP server for downstream miners
- sw_miner.c/h: software SHA256d miner using mbedtls
- asic_miner.c/h: ASIC detection stub (software fallback)
- test_mining_payment.c: 23 unit tests for mining payment module
</content>
</entry>
<entry>
<title>feat: local Nostr relay with relay selection, sync, and integration tests</title>
<updated>2026-05-18T21:02:41+00:00</updated>
<author>
<name>Your Name</name>
<email>you@example.com</email>
</author>
<published>2026-05-18T21:01:19+00:00</published>
<link rel='alternate' type='text/html' href='https://upleb.uk/npub12m5exm2uk3xa674cc5r0hlyvccs5xxn7qv83ezuteefv5972nquq4j4szl/esp32-tollgate/commit/?id=81f2dc52dc42d01c89dff45a5407ec40b8863052'/>
<id>urn:sha1:81f2dc52dc42d01c89dff45a5407ec40b8863052</id>
<content type='text'>
Local Nostr relay (NIP-01) on port 4869 with LittleFS 4MB storage.
All events published locally first, then synced to public relays via REQ-diff.
Relay selection via NIP-11 HTTP probing with NIP-77 scoring and auto-failover.

Components:
- wisp_relay: 16-file local relay (ws_server, storage_engine, sub_manager,
  broadcaster, relay_validator, router, handlers, rate_limiter, nip11,
  deletion, flash_monitor, relay_types)
- esp_littlefs: LittleFS VFS integration (git submodule)
- negentropy: for future NIP-77 binary sync (git submodule)

New source files:
- local_relay.c/h: thin wrapper for relay init/start/publish
- relay_selector.c/h: NIP-11 probe + scoring + auto-failover
- sync_manager.c/h: REQ-diff sync (primary 30min, fallback 6h)

Bug fixes:
- config.c: use-after-free (cJSON_Delete before seed_relays/sync parsing)
- local_relay: moved init to app_main for boot-time start (not gated on STA IP)

Flash layout: 4MB LittleFS partition at 0x500000 for relay_store

Test results (Board B, live hardware):
- Smoke: ping + HTTP 4869 + NIP-11: PASS
- NIP-11 info document: 10/11 PASS
- WS pub/sub (connect, REQ/EOSE, EVENT/OK, CLOSE, concurrent): 6/6 PASS
- Unit tests (relay_validator + relay_selector): 13/13 PASS

Hardware test make targets in physical-router-test-automation/:
- make relay-build, relay-flash-b, relay-test-smoke/nip11/pubsub/sync/full
</content>
</entry>
<entry>
<title>test: add unit tests for relay_validator and relay_selector</title>
<updated>2026-05-18T20:01:47+00:00</updated>
<author>
<name>Your Name</name>
<email>you@example.com</email>
</author>
<published>2026-05-18T20:01:47+00:00</published>
<link rel='alternate' type='text/html' href='https://upleb.uk/npub12m5exm2uk3xa674cc5r0hlyvccs5xxn7qv83ezuteefv5972nquq4j4szl/esp32-tollgate/commit/?id=3b25d826df2b69496fcc560a8ca26089484230c7'/>
<id>urn:sha1:3b25d826df2b69496fcc560a8ca26089484230c7</id>
<content type='text'>
- test_relay_validator: Schnorr verify + SHA-256 event ID, tamper detection
  (ID, sig, content), invalid JSON, missing fields, result_string
- test_relay_selector: relay scoring (NIP-77 bonus, latency tiebreak,
  failure penalty, dead relay handling)
- Updated Makefile with new test targets
- Added configTICK_RATE_HZ to FreeRTOS stubs
</content>
</entry>
<entry>
<title>feat: ContextVM (MCP over Nostr) server with full integration</title>
<updated>2026-05-18T19:40:06+00:00</updated>
<author>
<name>Your Name</name>
<email>you@example.com</email>
</author>
<published>2026-05-18T19:40:06+00:00</published>
<link rel='alternate' type='text/html' href='https://upleb.uk/npub12m5exm2uk3xa674cc5r0hlyvccs5xxn7qv83ezuteefv5972nquq4j4szl/esp32-tollgate/commit/?id=42902a36bc52e009a1e8d3c371741e30a9cb4c33'/>
<id>urn:sha1:42902a36bc52e009a1e8d3c371741e30a9cb4c33</id>
<content type='text'>
Complete CVM implementation: persistent WebSocket relay listener,
kind 25910 event subscription, MCP protocol handlers, CEP-6 announcements,
10 MCP tools, per-board hardware locks, WiFi EU regulatory fix.

Architecture:
- cvm_server.c: WS relay listener, kind 25910 subscription, MCP dispatch
- mcp_handler.c/h: 10 MCP tools (get_config, set_config, get_balance,
  wallet_send, get_sessions, get_usage, set_payout, set_metric,
  set_price, wallet_melt)
- Responses published via existing WS connection (not new TLS)
- Auth check: only owner npub accepted
- CEP-6: kinds 11316 (server), 11317 (tools), 10002 (relay list)
- WS ping/pong keepalive every 30s, 60s TLS read timeout

Critical fixes:
- WiFi country code DE (ESP-IDF defaults to CN, breaks EU APs)
- Subscription #p filter must be array not string
- Use-after-free: tags_str freed before nostr_event_to_json
- MCP responses via existing WS (ESP32 can't open multiple TLS)
- EVENT msg buffer underflow, WS frame masking, TLS write loop

Per-board hardware locks:
- Lock files in physical-router-test-automation/locks/
- lock-a/b/c, unlock-a/b/c targets in 3 Makefiles
- All hardware-touching targets require board lock

Verified on Board B via relay.primal.net:
- 282 unit tests passing (61 CVM + 60 MCP + 161 existing)
- MCP initialize roundtrip: PASS
- tools/list: PASS
- tools/call get_config: PASS
- tools/call get_balance: PASS
- tools/call set_price: PASS (write operation)
- CEP-6 announcements (11316, 11317, 10002): all accepted by relay
- WiFi STA connection (EnterSSID-2.4GHz): PASS with country code DE
- Board A WiFi confirmed hardware issue (not firmware)
</content>
</entry>
<entry>
<title>Phase 7: MCP handler (25 tests), NIP-04 encrypt/decrypt (15 tests), CVM server skeleton</title>
<updated>2026-05-16T23:57:06+00:00</updated>
<author>
<name>Your Name</name>
<email>you@example.com</email>
</author>
<published>2026-05-16T23:57:06+00:00</published>
<link rel='alternate' type='text/html' href='https://upleb.uk/npub12m5exm2uk3xa674cc5r0hlyvccs5xxn7qv83ezuteefv5972nquq4j4szl/esp32-tollgate/commit/?id=fdf662f8f1a1a3b38fe4d251982fffab8e9bf664'/>
<id>urn:sha1:fdf662f8f1a1a3b38fe4d251982fffab8e9bf664</id>
<content type='text'>
- mcp_handler.c/h: 4 tools (get_config, set_config, get_balance, wallet_send)
- nip04.c/h: AES-256-CBC + ECDH with 0x02 compressed pubkey prefix
  - Fixed IV copy bug: mbedTLS AES-CBC modifies IV in-place
  - Base64 encode/decode for ciphertext transport
  - PKCS7 padding
- cvm_server.c/h: Nostr DM listener with FreeRTOS task
- config: cvm_enabled, cvm_relays fields
- 156 total tests passing across 10 test binaries
</content>
</entry>
<entry>
<title>feat(phase6): bytes-based billing - dual metric support</title>
<updated>2026-05-16T23:20:07+00:00</updated>
<author>
<name>Your Name</name>
<email>you@example.com</email>
</author>
<published>2026-05-16T23:20:07+00:00</published>
<link rel='alternate' type='text/html' href='https://upleb.uk/npub12m5exm2uk3xa674cc5r0hlyvccs5xxn7qv83ezuteefv5972nquq4j4szl/esp32-tollgate/commit/?id=edd125d0e3fe5fe7c0edf30c429723f3b0120c68'/>
<id>urn:sha1:edd125d0e3fe5fe7c0edf30c429723f3b0120c68</id>
<content type='text'>
- session_create_bytes() + session_add_bytes() for bytes-metric sessions
- session_is_expired() dispatches on config metric (bytes vs milliseconds)
- cashu_calculate_allotment() unified dispatcher for both metrics
- tollgate_api discovery/usage/session_event use configured metric
- config: metric field defaults to 'bytes', step_size_bytes=22020096 (21MB)
- 14 new unit tests (148 total passing)
- ASSERT_EQ_UINT64 macro added to test framework
</content>
</entry>
<entry>
<title>Phase 5: Lightning auto-payout with LNURL-pay and NUT-05 melt</title>
<updated>2026-05-16T23:07:15+00:00</updated>
<author>
<name>Your Name</name>
<email>you@example.com</email>
</author>
<published>2026-05-16T23:07:15+00:00</published>
<link rel='alternate' type='text/html' href='https://upleb.uk/npub12m5exm2uk3xa674cc5r0hlyvccs5xxn7qv83ezuteefv5972nquq4j4szl/esp32-tollgate/commit/?id=cb4bd7d7c10cadcb43f82c09b13ffed744e541f7'/>
<id>urn:sha1:cb4bd7d7c10cadcb43f82c09b13ffed744e541f7</id>
<content type='text'>
- New lnurl_pay.c/h: LNURL-pay protocol (GET .well-known/lnurlp + callback)
- New lightning_payout.c/h: threshold-based auto-payout with multi-recipient split
- Extended nucula_wallet bridge with nucula_wallet_melt() (NUT-05)
- Config: payout section with multi-mint, multi-recipient, fee_tolerance
- Default: enabled, TollGate@coinos.io, min_payout=128, min_balance=64
- 18 new unit tests (all passing), 134 total
</content>
</entry>
<entry>
<title>Phase 4: TollGate client detection + auto-payment</title>
<updated>2026-05-16T22:51:39+00:00</updated>
<author>
<name>Your Name</name>
<email>you@example.com</email>
</author>
<published>2026-05-16T22:51:39+00:00</published>
<link rel='alternate' type='text/html' href='https://upleb.uk/npub12m5exm2uk3xa674cc5r0hlyvccs5xxn7qv83ezuteefv5972nquq4j4szl/esp32-tollgate/commit/?id=78dd599277b8e8b2ddc39a4ae710ec91d737272e'/>
<id>urn:sha1:78dd599277b8e8b2ddc39a4ae710ec91d737272e</id>
<content type='text'>
- New tollgate_client.c/h: detect upstream TollGate (kind=10021),
  auto-pay via nucula wallet, session monitoring with 20% renewal
- State machine: IDLE→DETECTING→NEEDS_PAY→PAYING→PAID→RENEWING
- Blocking: upstream payment before local services start
- Synchronous wallet init (was async task)
- Client config: enabled, steps_to_buy, renewal_threshold_pct
- Updated PLAN.md with Phases 4-7 (client, payout, bytes, CVM)
- Updated CHECKLIST.md with all new phase items
- 30 new unit tests (all passing), 116 total
</content>
</entry>
<entry>
<title>test_nostr_event: 23/23 passing — NIP-01 event ID, Schnorr signing, JSON serialization</title>
<updated>2026-05-16T20:08:55+00:00</updated>
<author>
<name>Your Name</name>
<email>you@example.com</email>
</author>
<published>2026-05-16T20:08:55+00:00</published>
<link rel='alternate' type='text/html' href='https://upleb.uk/npub12m5exm2uk3xa674cc5r0hlyvccs5xxn7qv83ezuteefv5972nquq4j4szl/esp32-tollgate/commit/?id=60e0a1042e5c56fe7d4b46d760441391df4ff809'/>
<id>urn:sha1:60e0a1042e5c56fe7d4b46d760441391df4ff809</id>
<content type='text'>
</content>
</entry>
</feed>
