nx_torrent_seed_gate.nx
buildroot/runtime/nx_torrent_seed_gate.nx
about
nx_torrent_seed_gate.nx -- SOVEREIGN LOOPBACK GATE for the BitTorrent SEEDER (nx_torrent_seed).
Proves the missing UPLOAD half end-to-end: a real leecher connects to OUR seeder and pulls VERIFIED
pieces off it. This is the exact inverse of nx_peer_download (which proved we can leech): here WE are
the source. bind-before-fork (no race); child = the seed core `ts_serve_peer` over a real temp file;
parent = a mock leecher that handshakes, reads our BITFIELD (all-present) + UNCHOKE, REQUESTs a piece
in 16-byte blocks, assembles it, and asserts (a) the bytes == the file's bytes, (b) sha1(piece) ==
sha1(file slice) [the BitTorrent integrity guarantee], and (c) a request past EOF on the last, partial
piece is CLAMPED to the real length. Deterministic; no external net; no-hang (socket timeouts).
Run: ./_offc/nx_sov_build_run.elf nx_torrent_seed_gate (WOMB builds + runs; main() = the gate)
license_tier: ORIGINAL module: nishi-core.torrent.seed_gate
depends: nishi-core.torrent.seed, nishi-core.torrent.peerwire, nishi-core.crypto.sha1
dependencies 5 imports · 0 importers
imports: nx_torrent_seed.nxnx_connect.nxnx_peerwire.nxnx_sha1.nxnx_gate_verdict.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 20 | const G_PLEN: i64 = 64 |
| 21 | const G_NPC: i64 = 3 |
| 22 | const G_TOTAL: i64 = 160 // 64 + 64 + 32 (last piece is PARTIAL -> exercises EOF clamp) |
| 23 | const G_BLK: i64 = 16 |
| 24 | const G_PATH: *u8 = "/tmp/_nx_seed_test.bin" as *u8 |
functions
| 26 | func g_w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } called by 1: main |
| 27 | func g_wn(v: i64) -> i64 called by 1: main |
| 33 | func main() -> i64 |