diff options
Diffstat (limited to 'MINER_INTEGRATION_PLAN.md')
| -rw-r--r-- | MINER_INTEGRATION_PLAN.md | 120 |
1 files changed, 71 insertions, 49 deletions
diff --git a/MINER_INTEGRATION_PLAN.md b/MINER_INTEGRATION_PLAN.md index 7b4554d..00c4a0c 100644 --- a/MINER_INTEGRATION_PLAN.md +++ b/MINER_INTEGRATION_PLAN.md | |||
| @@ -55,41 +55,47 @@ ESP-Miner-NerdQAxePlus (fork of shufps/ESP-Miner-NerdQAxePlus) | |||
| 55 | 55 | ||
| 56 | ## Plan Checklist | 56 | ## Plan Checklist |
| 57 | 57 | ||
| 58 | ### Step 1: Fix Master Build — COMPLETE | 58 | ### Step 1: Fix Master Build — COMPLETE (commit `62bce81`) |
| 59 | 59 | ||
| 60 | - [x] Create `components/negentropy/CMakeLists.txt` (register C++ wrapper as ESP-IDF component) | 60 | - [x] Create `components/negentropy_lib/` wrapper component (mbedTLS SHA-256 compat for negentropy submodule) |
| 61 | - [x] Fix `main/CMakeLists.txt` (remove `esp_littlefs`, `esp_timer`, `tcp_transport` from REQUIRES) | 61 | - [x] Fix `main/CMakeLists.txt` (remove `esp_littlefs`, `esp_timer`; keep `tcp_transport`) |
| 62 | - [x] `idf.py build` passes on master | 62 | - [x] Fix `config.c` duplicate seed_relays/sync_interval/fallback_interval blocks |
| 63 | - [x] Remove leftover merge conflict marker in `tollgate_api.c` | ||
| 64 | - [x] `idf.py build` passes on master (1.3MB, 68% free) | ||
| 63 | - [x] `make test-unit` passes (19 test suites, 344+ assertions) | 65 | - [x] `make test-unit` passes (19 test suites, 344+ assertions) |
| 64 | - [x] Commit + push | 66 | - [x] Committed (push failed — nostr relay state event rejection) |
| 65 | 67 | ||
| 66 | ### Step 2: Create Miner Integration Branch + Worktree | 68 | ### Step 2: Create Miner Integration Branch + Worktree — COMPLETE |
| 67 | 69 | ||
| 68 | - [ ] Create `feature/miner-integration` branch from master | 70 | - [x] Create `feature/miner-integration` branch from master |
| 69 | - [ ] Create git worktree at `/home/c03rad0r/esp32-miner-integration` | 71 | - [x] Create git worktree at `/home/c03rad0r/esp32-miner-integration` |
| 70 | - [ ] Verify worktree builds and tests pass (same as master) | 72 | - [x] Initialize git submodules in worktree (esp_littlefs, negentropy, nucula_src) |
| 71 | 73 | - [x] Verify worktree builds and tests pass | |
| 72 | ### Step 3: Cherry-pick tollgate_core Skeleton from Arch Branch | 74 | |
| 73 | 75 | ### Step 3: Cherry-pick tollgate_core Skeleton from Arch Branch — COMPLETE | |
| 74 | - [ ] Copy `components/tollgate_core/CMakeLists.txt` from `feature/tollgate-core-component` | 76 | |
| 75 | - [ ] Copy `components/tollgate_core/idf_component.yml` from `feature/tollgate-core-component` | 77 | - [x] Copy `components/tollgate_core/CMakeLists.txt` from `feature/tollgate-core-component` |
| 76 | - [ ] Copy `components/tollgate_core/include/tollgate_core.h` from `feature/tollgate-core-component` | 78 | - [x] Copy `components/tollgate_core/idf_component.yml` from `feature/tollgate-core-component` |
| 77 | - [ ] Copy `components/tollgate_core/include/tollgate_platform.h` from `feature/tollgate-core-component` | 79 | - [x] Copy `components/tollgate_core/include/tollgate_core.h` from `feature/tollgate-core-component` |
| 78 | - [ ] Extend `tollgate_platform.h` with mining callbacks (get_stratum_url, on_share_accepted, etc.) | 80 | - [x] Copy `components/tollgate_core/include/tollgate_platform.h` from `feature/tollgate-core-component` |
| 79 | - [ ] Extend `tollgate_core.h` with mining API (tollgate_core_start_stratum_proxy, etc.) | 81 | - [x] Extend `tollgate_platform.h` with mining callbacks (get_stratum_url, on_share_accepted, etc.) |
| 80 | 82 | - [x] Extend `tollgate_core.h` with mining API (tollgate_core_stratum_proxy_start, etc.) | |
| 81 | ### Step 4: Populate tollgate_core with Current Master Modules | 83 | |
| 82 | 84 | ### Step 4: Populate tollgate_core with Current Master Modules — COMPLETE (commit `6a61810`) | |
| 83 | - [ ] Copy + rename `main/cashu.c` → `components/tollgate_core/src/tollgate_core_cashu.c` | 85 | |
| 84 | - [ ] Copy + rename `main/dns_server.c` → `components/tollgate_core/src/tollgate_core_dns.c` | 86 | - [x] Copy from arch branch: `tollgate_core_cashu.c/h` (Cashu token decode/verify) |
| 85 | - [ ] Copy + rename `main/firewall.c` → `components/tollgate_core/src/tollgate_core_firewall.c` | 87 | - [x] Copy from arch branch: `tollgate_core_dns.c/h` (per-client DNS hijack/forward) |
| 86 | - [ ] Copy + rename `main/session.c` → `components/tollgate_core/src/tollgate_core_session.c` | 88 | - [x] Copy from arch branch: `tollgate_core_firewall.c/h` (per-client NAT filter) |
| 87 | - [ ] Copy + rename `main/mining_payment.c` → `components/tollgate_core/src/tollgate_core_mining.c` | 89 | - [x] Copy from arch branch: `tollgate_core_session.c/h` (session lifecycle) |
| 88 | - [ ] Copy + rename `main/stratum_proxy.c` → `components/tollgate_core/src/tollgate_core_stratum_proxy.c` | 90 | - [x] Copy from arch branch: `tollgate_core.c` (orchestrator — init, payment, tick, owner) |
| 89 | - [ ] Implement `tollgate_core.c` — wire all sub-modules via platform callbacks | 91 | - [x] Create `tollgate_core_mining.c/h` (from mining_payment.c — hashprice, share validation, client stats) |
| 92 | - [x] Create `tollgate_core_stratum_proxy.c/h` (from stratum_proxy.c — local SV1 TCP server) | ||
| 93 | - [x] Fix nucula_src `save_proofs` visibility (public) | ||
| 94 | - [x] `idf.py build` passes | ||
| 95 | - [x] `make test-unit` passes | ||
| 90 | - [ ] Update `components/tollgate_core/CMakeLists.txt` with all SRCS and REQUIRES | 96 | - [ ] Update `components/tollgate_core/CMakeLists.txt` with all SRCS and REQUIRES |
| 91 | 97 | ||
| 92 | ### Step 5: Wire tollgate_core into Standalone Build | 98 | ### Step 5: Wire tollgate_core into Standalone Build — DEFERRED |
| 93 | 99 | ||
| 94 | - [ ] Create `main/tollgate_platform.c` implementing platform interface (SPIFFS config) | 100 | - [ ] Create `main/tollgate_platform.c` implementing platform interface (SPIFFS config) |
| 95 | - [ ] Update `main/CMakeLists.txt` — remove old SRCS, add tollgate_core to REQUIRES | 101 | - [ ] Update `main/CMakeLists.txt` — remove old SRCS, add tollgate_core to REQUIRES |
| @@ -101,24 +107,40 @@ ESP-Miner-NerdQAxePlus (fork of shufps/ESP-Miner-NerdQAxePlus) | |||
| 101 | - [ ] Flash to Board A + smoke test | 107 | - [ ] Flash to Board A + smoke test |
| 102 | - [ ] Commit | 108 | - [ ] Commit |
| 103 | 109 | ||
| 104 | ### Step 6: Fork NerdQAxePlus + Set Up Build | 110 | Note: Deferred to after NerdQAxePlus integration is working. The standalone build works fine |
| 105 | 111 | with existing main/ code. The component is ready for consumption by external projects. | |
| 106 | - [ ] Fork `shufps/ESP-Miner-NerdQAxePlus` on GitHub | 112 | |
| 107 | - [ ] Clone fork to `/home/c03rad0r/esp-miner-nerdqaxeplus/` | 113 | ### Step 6: Fork NerdQAxePlus + Set Up Build — COMPLETE |
| 108 | - [ ] Verify stock build: `BOARD=NERDAXE idf.py build` | 114 | |
| 109 | - [ ] Add `main/idf_component.yml` declaring tollgate_core dependency | 115 | - [x] Clone `shufps/ESP-Miner-NerdQAxePlus` to `/home/c03rad0r/esp-miner-nerdqaxeplus/` |
| 110 | - [ ] Verify Component Manager resolves tollgate_core | 116 | - [x] Initialize git submodules (libsecp256k1) |
| 111 | 117 | - [x] Set target to ESP32-S3: `BOARD=NERDAXE idf.py set-target esp32s3` | |
| 112 | ### Step 7: Implement NerdQAxePlus TollGate Integration | 118 | - [x] Verify stock build: `BOARD=NERDAXE idf.py build` — PASS (2.9MB, 29% free) |
| 113 | 119 | - [x] Identified key integration points: | |
| 114 | - [ ] Create `main/tollgate_platform.cpp` — implements platform interface with NVS config + ASIC state | 120 | - `main/tasks/asic_result_task.cpp:121` — share accepted hook |
| 115 | - [ ] Create `main/boards/tollgate_board.h/cpp` — TollGateBoard extends NerdAxe (AP+STA WiFi) | 121 | - `main/main.cpp:282` — wifi_softap_off() (must skip for TollGate AP mode) |
| 116 | - [ ] Patch `main/tasks/asic_result_task.cpp` — `#ifdef TOLLGATE` hook on share accepted | 122 | - `main/main.cpp:307-313` — task creation (add tollgate tasks) |
| 117 | - [ ] Patch `main/main.cpp` — `#ifdef TOLLGATE` init block (AP, DNS, captive portal, stratum proxy) | 123 | - `components/connect/connect.c:162` — APSTA mode already supported |
| 118 | - [ ] Create `main/lwip_tollgate_hooks.h` — LWIP hook forwarding to tollgate_core | 124 | |
| 119 | - [ ] Update `main/CMakeLists.txt` — conditional TOLLGATE sources | 125 | ### Step 7: Implement NerdQAxePlus TollGate Integration — COMPLETE (commit `83e09ab9`) |
| 120 | - [ ] Update top-level `CMakeLists.txt` — `-DTOLLGATE` compile definition when env var set | 126 | |
| 121 | - [ ] Build: `BOARD=NERDAXE TOLLGATE=1 idf.py build` | 127 | - [x] Create `main/tollgate_platform.cpp` — implements platform interface with NVS config + ASIC state |
| 128 | - [x] Create `main/tollgate_nerdqaxe.h` — init declarations for main.cpp/asic_result_task.cpp | ||
| 129 | - [x] Patch `main/tasks/asic_result_task.cpp` — `#ifdef TOLLGATE` hook on share accepted | ||
| 130 | - [x] Patch `main/main.cpp` — skip `wifi_softap_off()`, call `tollgate_nerdqaxe_init()` after mining starts | ||
| 131 | - [x] Update `main/CMakeLists.txt` — conditional TOLLGATE sources via `$ENV{TOLLGATE}` | ||
| 132 | - [x] Update top-level `CMakeLists.txt` — `-DTOLLGATE` compile definition when env var set | ||
| 133 | - [x] Add TollGate NVS keys to `main/nvs_config.h` | ||
| 134 | - [x] Symlink `components/tollgate_core` from esp32-miner-integration worktree | ||
| 135 | - [x] Build: `BOARD=NERDAXE TOLLGATE=1 idf.py build` — PASS (2.9MB) | ||
| 136 | - [x] Stock build: `BOARD=NERDAXE idf.py build` — PASS (unaffected) | ||
| 137 | - [x] tollgate_core: extern "C" guards, stratum_proxy_init name fix, conditional NAPT | ||
| 138 | - [x] `ngit init` NerdQAxePlus as separate nostr repo (`esp-miner-nerdqaxeplus-tollgate`) | ||
| 139 | - [x] Push to `git.orangesync.tech` GRASP server | ||
| 140 | - [x] Cross-reference documentation (REMOTES.md in both repos) | ||
| 141 | |||
| 142 | Note: `main/boards/tollgate_board.h/cpp` and `main/lwip_tollgate_hooks.h` deferred — | ||
| 143 | using simpler `#ifdef TOLLGATE` patches directly in existing files instead. | ||
| 122 | 144 | ||
| 123 | ### Step 8: Hardware Testing on NerdAxe Ultra | 145 | ### Step 8: Hardware Testing on NerdAxe Ultra |
| 124 | 146 | ||