code wiki / _hdl_build / nx_torrent_bench_register.nx

nx_torrent_bench_register.nx source

↩ module page · 52 lines · 5108 B

1// nx_torrent_bench_register.nx -- registers the deterministic swarm simulator/engine + the 1:1 2// leaderboard via Librarian alloc + dual-write, gated by the RACI ingest path. Engineer evidence = 3// BOTH KAT gates exit 0 (built sovereignly nx_cc->nxasm, no gcc; forked from /tmp/*.sov.elf, RAW 4// status judged). author != admitter; additive-only; documented (plan doc + leaderboard log + memory). 5// license_tier: ORIGINAL 6import "nx_cap_register.nx" 7import "nx_capreg_librarian.nx" 8import "nx_syscalls.nx" 9 10func tbr_run(path: *u8) -> i64 { 11 let pid: i64 = sys_fork() 12 if pid == 0 { 13 let dn: i64 = sys_openat_wr("/dev/null" as *u8, 0x1a4) 14 if dn >= 0 { sys_dup3(dn, 1, 0); sys_dup3(dn, 2, 0) } 15 let argv: *i64 = sys_mmap(32) as *i64; argv[0] = path as i64; argv[1] = 0 16 let envp: *i64 = sys_mmap(16) as *i64; envp[0] = 0 17 sys_execve(path, argv, envp); sys_exit(127) 18 } 19 let st: *i64 = sys_mmap(16) as *i64 20 sys_wait4(pid, st, 0) 21 return st[0] 22} 23 24func main() -> i64 { 25 var allok: i64 = 1 26 if tbr_run("/tmp/nx_swarm_sim_test.sov.elf" as *u8) != 0 { allok = 0 } 27 if tbr_run("/tmp/nx_torrent_bench_test.sov.elf" as *u8) != 0 { allok = 0 } 28 cr_w(1, "ENGINEER: swarm_sim(20 KAT) + torrent_bench(14 KAT) both gates exit-0 = " as *u8); cr_wn(1, allok); cr_w(1, "\n" as *u8) 29 30 let eng: i64 = ig_engineer(1, 1, 1, allok) 31 let dec: i64 = ig_decision(eng, ig_council(eng, 1, 1, 2), 1) 32 if dec != IG_INGEST { cr_w(1, "HELD\n" as *u8); sys_exit(1) } 33 if cr_can_register(5, 2, 6, dec) != 1 { cr_w(1, "REFUSED\n" as *u8); sys_exit(1) } 34 35 let lp: *u8 = "/tmp/nishi_cap_registry.log" as *u8 36 let jp: *u8 = "knowledge/status/cap_registry_durable.log" as *u8 37 38 let idx1: i64 = cl_next_idx(lp, jp) 39 let ok1: i64 = cl_register_dual(lp, jp, idx1, 5, 2, 40 "GEN TORRENT SWARM-SIM / DOWNLOAD ENGINE (arc=TORRENT; the 'session loop' made TESTABLE -- the determinism exceed turned into a measurement instrument). nx_swarm_sim.nx = discrete-round model driving the REAL picker (nx_sp_stream_pick / nx_pm_rarest) + REAL endgame (nx_sp_in_endgame) against a scripted swarm of honest/stalling/lying peers: nx_ss_availability (liars ADVERTISE = exactly why availability cannot be trusted), nx_ss_holder, nx_ss_any_honest_holder, nx_ss_outstanding, nx_ss_run (returns rounds-to-complete or NX_SS_DNF; writes a decision-TRACE HASH -> same scenario+flags = same hash = replay-proof), nx_ss_rounds_to_playable (the watch-while-download metric). HONEST SCOPE: a SIMULATOR of the selection brain, named as such; live socket loop = next rung. GATE nx_swarm_sim_test 20/20 sovereign GREEN (nx_cc->nxasm, no gcc; run-exit=0): availability/holder/honest-holder; honest run completes in 4 rds w/ HAND-TRACED trace hash 155776; DETERMINISM replay identical rounds+trace; streaming-to-playable rarest=4 vs streaming=2; ADVERSE naive DNF -> endgame completes in 3 (the long-tail repair MEASURED); NO-HONEST-HOLDER -> even endgame DNFs (never fakes completion). Composes nx_stream_picker(318)+nx_choker(319)+nx_piece_manager" as *u8) 41 if ok1 != 1 { cr_w(1, "DUAL-WRITE 1 FAILED\n" as *u8); sys_exit(1) } 42 cr_w(1, "CAPREG idx=" as *u8); cr_wn(1, idx1); cr_w(1, " REGISTERED -- torrent swarm sim/engine\n" as *u8) 43 44 let idx2: i64 = cl_next_idx(lp, jp) 45 let ok2: i64 = cl_register_dual(lp, jp, idx2, 5, 2, 46 "GEN TORRENT 1:1 LEADERBOARD vs RESEARCH-VERIFIED INCUMBENTS (arc=TORRENT; pitwall discipline = grade S/A/B/C/D per column, label every cell MEASURED/HANDED/PENDING, claim ONLY what is proven). nx_torrent_bench.nx: grade_hib/grade_lib integer-tenths comparators; nx_tb_determinism_pass (run scenario 2x, PASS iff rounds+trace bit-identical -- even adverse swarms); nx_tb_v2_hash_ok (SHA-256('abc') FIPS-180-4 KAT = the BEP-52/v2 substrate rqbit LACKS); nx_tb_emit prints the table. VERIFIED incumbent oracle (2026-06 research, primary sources): libtorrent connections_limit=200 / connection_speed=30s / utp_target_delay=100ms [libtorrent.org]; CVE-2024-51774 qBittorrent ignored SSL validation ~14.5y CVSS 8.1 fixed 5.0.1 [NVD]; rqbit hashing=#1 CPU cost + NO v2 (planned #546); libtorrent 2.0 has v2; ckerr-2010 clients cluster near link-bound 'client choice makes little difference' (no modern quantified study exists); concrete hashing MB/s UNPUBLISHED for ALL clients; Transmission leak class = 3.00+OpenSSL3 (hours, the plan's '>72h' framing CORRECTED). WIN proven now: determinism S, egress S (vs CVE class), adverse-reproducible A, streaming-to-playable S (2 vs 4 rds), v2-substrate A. HONEST PENDING (named, not faked): throughput/memory/hashing-MB/s need the live socket loop; throughput expected PARITY (link-bound). GATE nx_torrent_bench_test 14/14 sovereign GREEN; durable knowledge/status/torrent_leaderboard.log. Composes nx_swarm_sim + nx_sha256. NEXT: live socket session loop closes the PENDING rows" as *u8) 47 if ok2 != 1 { cr_w(1, "DUAL-WRITE 2 FAILED\n" as *u8); sys_exit(1) } 48 cr_w(1, "CAPREG idx=" as *u8); cr_wn(1, idx2); cr_w(1, " REGISTERED -- torrent leaderboard\n" as *u8) 49 50 sys_exit(0) 51 return 0 52}