code wiki / _hdl_build / _drv_f2_gate.nx
_drv_f2_gate.nx
buildroot/runtime/_hdl_build/_drv_f2_gate.nx
about
_drv_f2_gate.nx -- gate for the FEDERATED DRIVER REGISTRY (X-DRV-F2). NO mocks.
Proves the NETWORK EFFECT with real measurement + real signatures:
(0) MEASURE -- emit+run the two candidate configs (lean, verbose) on the sovereign emu and
read their REAL emu-steps (lean < verbose). No fabricated perf -- the reports carry these.
(1) SIGN -- build TWO nodes' signed reports (node A: verbose; node B: lean), each ed25519-signed
with that node's own identity key (genuine, 2 distinct nodes).
(2) NETWORK EFFECT -- run nx_fed_registry on node A ALONE -> winner = verbose (its only data);
run on A+B -> winner = lean. Assert two_node_winner_steps < one_node_winner_steps: the
registry is MEASURABLY improved by the SECOND node's data (the winner flows back).
(3) FLOW-BACK -- the 2-node winner config, re-run on the emu, achieves the registry's claimed
steps (the recommendation really delivers; report perf == reality).
(4) POISON-REJECTION -- a report with a BAD signature claiming steps=1 (would win if accepted)
is REJECTED -> the winner stays lean, NOT the poison. Only consenting, authentic data
refines the registry (you cannot poison it with unsigned reports).
Evidence -> knowledge/status/fed_registry.log (DRVF2GATE row). Sovereign. license_tier: ORIGINAL
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_ed25519_signature.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
| 21 | const F_EMIT: *u8 = "_offc/nx_drv_proto_emit.elf" |
| 22 | const F_SOV: *u8 = "_offc/nx_boot_run_sov.elf" |
| 23 | const F_FED: *u8 = "_offc/nx_fed_registry.elf" |
| 24 | const F_FEDOUT: *u8 = "knowledge/registry/driver_registry_federated.tsv" |
| 25 | const LEAN_SPEC: *u8 = "knowledge/specs/drv_proto_nndp_lean.spec" |
| 26 | const VERB_SPEC: *u8 = "knowledge/specs/drv_proto_nndp_verbose.spec" |
| 27 | const LEAN_BIN: *u8 = "runtime/_hdl_build/_drv_proto_nndp_lean.bin" |
| 28 | const VERB_BIN: *u8 = "runtime/_hdl_build/_drv_proto_nndp_verbose.bin" |
functions
| 30 | func g_p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 31 | func g_fp(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 } |
| 32 | func g_fn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(fd,bb,k); return 0 } |
| 34 | func g_run1(prog: *u8, a1: *u8, outpath: *u8) -> i64 called by 2: g_measureg_fed_winner calls 7: sys_forksys_openat_wrsys_dup3sys_mmapsys_execvesys_exit+1 |
| 55 | func g_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 66 | func g_parse_steps(buf: *u8, n: i64) -> i64 called by 1: g_measure |
| 81 | func g_measure(spec: *u8, bin: *u8, serial: *u8) -> i64 |
| 89 | func g_hex(src: *u8, n: i64, dst: *u8) -> i64 called by 1: g_report |
| 95 | func g_cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){dst[off+i]=s[i];i=i+1} return off+i } called by 1: g_report |
| 96 | func g_catn(dst: *u8, off: i64, v: i64) -> i64 { let t: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m}; var k: i64=0; if m==0{t[0]=48;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i: i64=0; while i<k{dst[off+i]=t[k-1-i];i=i+1}; return off+k } |
| 100 | func g_report(out: *u8, did: i64, cfg: *u8, steps: i64, priv: *u8, pub: *u8, corrupt: i64) -> i64 |
| 120 | func g_write(path: *u8, buf: *u8, n: i64) -> i64 { let fd: i64 = sys_openat_wr(path, 0x1a4); if fd<0 { return 0-1 } sys_write(fd, buf, n); sys_close(fd); return 0 } |
| 123 | func g_fed_winner(inbox: *u8) -> i64 |
| 142 | func g_count(buf: *u8, n: i64, pat: *u8) -> i64 { var pl: i64=0; while pat[pl]!=(0 as u8){pl=pl+1} var c: i64=0; var i: i64=0; while i+pl<=n { var k: i64=0; var hit: i64=1; while k<pl { if buf[i+k]!=pat[k]{hit=0;k=pl}else{k=k+1} } if hit==1 {c=c+1;i=i+pl} else {i=i+1} } return c } called by 1: main |
| 144 | func main() -> i64 |