diff options
Diffstat (limited to 'MERGE_PLAN.md')
| -rw-r--r-- | MERGE_PLAN.md | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/MERGE_PLAN.md b/MERGE_PLAN.md new file mode 100644 index 0000000..ff60e4b --- /dev/null +++ b/MERGE_PLAN.md | |||
| @@ -0,0 +1,119 @@ | |||
| 1 | # Mining Feature: Squash-Merge Execution Plan | ||
| 2 | |||
| 3 | ## Overview | ||
| 4 | Squash-merge `feature/mining-payment` into `master`, update relay config, push. | ||
| 5 | |||
| 6 | ## Repositories | ||
| 7 | - **Shared repo:** `/home/c03rad0r/esp32-tollgate` (master) | ||
| 8 | - **Mining worktree:** `/home/c03rad0r/esp32-tollgate-mining` (feature/mining-payment) | ||
| 9 | - **Backup:** `/home/c03rad0r/mining-work-backup/` | ||
| 10 | |||
| 11 | ## Checklist | ||
| 12 | |||
| 13 | ### Phase 1: Documentation & Config Updates | ||
| 14 | - [ ] 1.1 Write this MERGE_PLAN.md | ||
| 15 | - [ ] 1.2 Update `config.c` — add relays to nostr_seed_relays (8/8) and nostr_relays (4/4) | ||
| 16 | - [ ] 1.3 Update `AGENTS.md` — reflect new relay lists in shared repo | ||
| 17 | - [ ] 1.4 Commit relay config changes to worktree | ||
| 18 | |||
| 19 | ### Phase 2: Rebase & Test | ||
| 20 | - [ ] 2.1 Rebase `feature/mining-payment` onto `master` | ||
| 21 | - [ ] 2.2 Run `make test-unit` — all 15 suites must pass | ||
| 22 | |||
| 23 | ### Phase 3: Backup | ||
| 24 | - [ ] 3.1 Backup branch to `/home/c03rad0r/mining-work-backup/` | ||
| 25 | |||
| 26 | ### Phase 4: Squash-Merge | ||
| 27 | - [ ] 4.1 Squash-merge `feature/mining-payment` into `master` with detailed body | ||
| 28 | - [ ] 4.2 Run `make test-unit` on master to confirm | ||
| 29 | - [ ] 4.3 Run `idf.py build` on master to confirm clean build | ||
| 30 | |||
| 31 | ### Phase 5: Push & Cleanup | ||
| 32 | - [ ] 5.1 Push master to origin | ||
| 33 | - [ ] 5.2 Remove git worktree | ||
| 34 | - [ ] 5.3 Update MINING_WORKTREE_PLAN.md checklist | ||
| 35 | |||
| 36 | ## Relay Updates | ||
| 37 | |||
| 38 | ### nostr_seed_relays (TOLLGATE_MAX_SEED_RELAYS = 8) | ||
| 39 | | Slot | Relay | Latency | Notes | | ||
| 40 | |------|-------|---------|-------| | ||
| 41 | | 0 | wss://relay.orangesync.tech | existing | NIP-77 | | ||
| 42 | | 1 | wss://relay.damus.io | existing | | | ||
| 43 | | 2 | wss://nos.lol | existing | | | ||
| 44 | | 3 | wss://relay.nostr.band | existing | | | ||
| 45 | | 4 | wss://relay.anzenkodo.workers.dev | 90ms | FR, NIP-01 | | ||
| 46 | | 5 | wss://nostr.koning-degraaf.nl | 91ms | NL, NIP-01 | | ||
| 47 | | 6 | wss://knostr.neutrine.com | 103ms | FR, NIP-01 | | ||
| 48 | | 7 | wss://nostr.einundzwanzig.space | 106ms | DE | | ||
| 49 | |||
| 50 | ### nostr_relays (TOLLGATE_MAX_RELAYS = 4) | ||
| 51 | | Slot | Relay | Notes | | ||
| 52 | |------|-------|-------| | ||
| 53 | | 0 | wss://relay.damus.io | existing | | ||
| 54 | | 1 | wss://nos.lol | existing | | ||
| 55 | | 2 | wss://relay.anzenkodo.workers.dev | NEW | | ||
| 56 | | 3 | wss://nostr.koning-degraaf.nl | NEW | | ||
| 57 | |||
| 58 | ## Squash Commit Message | ||
| 59 | ``` | ||
| 60 | feat(mining): Bitcoin mining-for-bandwidth payment system | ||
| 61 | |||
| 62 | New modules: | ||
| 63 | - mining_payment.c/h: hashprice calc (nbits->difficulty->sat/GH/s/day), | ||
| 64 | share validation, client stats, allotment conversion (ms + bytes) | ||
| 65 | - stratum_client.c/h: SV1 upstream pool connection (subscribe/authorize/submit) | ||
| 66 | - stratum_proxy.c/h: Local SV1 TCP server for downstream miners, job broadcast | ||
| 67 | - sw_miner.c/h: Software SHA256d miner (ESP32 CPU fallback) | ||
| 68 | - asic_miner.c/h: ASIC detection stub (BM1366/BM1368 SPI) | ||
| 69 | |||
| 70 | Config: | ||
| 71 | - config.h/c: mining_payout_mode_t enum (auto/pool/upstream/proxy_only), | ||
| 72 | stratum pool settings, mining port, hashprice override, sandbox mint access | ||
| 73 | - Defaults fill nostr_seed_relays (8/8) and nostr_relays (4/4) with fast relays | ||
| 74 | |||
| 75 | Integration into existing modules: | ||
| 76 | - session.h/c: payment_method_t enum (CASHU/MINING/BYTES) | ||
| 77 | - firewall.h/c: firewall_set_mining_port(), firewall_set_sandbox_mint_access() | ||
| 78 | - tollgate_api.c: GET /mining/job, POST /mining/share, GET /mining/stats | ||
| 79 | - tollgate_client.h/c: TG_CLIENT_MINING state, mining discovery tag parsing | ||
| 80 | - tollgate_main.c: mining init in start_services(), stratum_client_tick() in loop | ||
| 81 | - captive_portal.c: tabbed Cashu/Mine UI with live hashrate polling | ||
| 82 | |||
| 83 | Unit tests (69 new assertions across 4 suites): | ||
| 84 | - test_mining_payment (23 tests): nbits->difficulty, hashprice, client stats, allotment | ||
| 85 | - test_stratum_proxy (21 tests): job set/get, stats, type validation | ||
| 86 | - test_session_payment_method (12 tests): PAYMENT_METHOD enum, bytes/cashu methods | ||
| 87 | - test_tollgate_client_mining (20 tests): mining tag parsing, discovery struct | ||
| 88 | - test_firewall_sandbox (16 tests): client grant/revoke, max clients, setters | ||
| 89 | |||
| 90 | Enhanced test stubs: | ||
| 91 | - BaseType_t/pdPASS in freertos/task.h | ||
| 92 | - lwip: sockets.h, etharp.h, prot/ip.h, prot/ip4.h, prot/tcp.h, netif.h | ||
| 93 | - dns_server.h, esp_wifi_ap_get_sta_list.h | ||
| 94 | |||
| 95 | Build fixes: | ||
| 96 | - cvm_server.c: replace esp_timer_get_time() with xTaskGetTickCount(), | ||
| 97 | fix process_relay_message() 3-arg call to 2-arg | ||
| 98 | - stratum_proxy.c: widen task_name buffer 16->20 | ||
| 99 | - sw_miner.c: add missing #include esp_random.h | ||
| 100 | - nucula_src: save_proofs() moved to public in wallet.hpp | ||
| 101 | |||
| 102 | Nostr relay updates: | ||
| 103 | - nostr_seed_relays: +relay.anzenkodo.workers.dev, +nostr.koning-degraaf.nl, | ||
| 104 | +knostr.neutrine.com, +nostr.einundzwanzig.space (8/8 slots) | ||
| 105 | - nostr_relays: +relay.anzenkodo.workers.dev, +nostr.koning-degraaf.nl (4/4 slots) | ||
| 106 | |||
| 107 | Binary: 1.2MB, 70% partition free (ESP32-S3, 16MB flash) | ||
| 108 | ``` | ||
| 109 | |||
| 110 | ## Commits on feature/mining-payment (before squash) | ||
| 111 | 1. `c75230e` — feat(mining): add new mining source files and unit tests | ||
| 112 | 2. `beb73a2` — feat(mining): integrate mining subsystem into existing modules | ||
| 113 | 3. `473b4d1` — fix: build errors in cvm_server, stratum_proxy, sw_miner + nucula visibility | ||
| 114 | 4. `ef9ae98` — test: add 4 new unit test suites for mining modules | ||
| 115 | |||
| 116 | ## Rules | ||
| 117 | - No comments in code unless explicitly requested | ||
| 118 | - Commit + push after each checkpoint | ||
| 119 | - Shared repo must stay on master, clean | ||