code wiki / _hdl_build / _drv_f2_gate.nx

_drv_f2_gate.nx

buildroot/runtime/_hdl_build/_drv_f2_gate.nx

13069 B211 linesdepth 9pulls 12 transitivereach 0 importersview sourcekind gate/prooftopic drv
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_ed25519_signature.nx _drv_f2_gate.nx

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

main g_p sys_write sys_openat_append g_measure g_run1 sys_fork sys_openat_wr sys_dup3 sys_mmap sys_execve sys_exit sys_wait4 sys_mmap ↻ g_read sys_openat_rd sys_read sys_close g_parse_steps sys_mmap ↻ ed25519_pub_from_priv sys_mmap ↻ ed25519_sha512 sys_mmap ↻ sha512_init sha512_update sha512_blk_set_byte blk_get_i64 blk_set_i64 sha512_compress sys_mmap ↻ blk_get_i64 ↻ sha512_gamma0 rotr64_v shr64_v sha512_gamma1 rotr64_v ↻ shr64_v ↻ sha512_sigma1 rotr64_v ↻

structs

none

consts

21const F_EMIT: *u8 = "_offc/nx_drv_proto_emit.elf"
22const F_SOV: *u8 = "_offc/nx_boot_run_sov.elf"
23const F_FED: *u8 = "_offc/nx_fed_registry.elf"
24const F_FEDOUT: *u8 = "knowledge/registry/driver_registry_federated.tsv"
25const LEAN_SPEC: *u8 = "knowledge/specs/drv_proto_nndp_lean.spec"
26const VERB_SPEC: *u8 = "knowledge/specs/drv_proto_nndp_verbose.spec"
27const LEAN_BIN: *u8 = "runtime/_hdl_build/_drv_proto_nndp_lean.bin"
28const VERB_BIN: *u8 = "runtime/_hdl_build/_drv_proto_nndp_verbose.bin"

functions

30func 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 }
called by 1: main calls 1: sys_write
31func 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 }
called by 1: main calls 1: sys_write
32func 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 }
called by 1: main calls 2: sys_mmapsys_write
34func g_run1(prog: *u8, a1: *u8, outpath: *u8) -> i64
55func g_read(path: *u8, buf: *u8, cap: i64) -> i64
66func g_parse_steps(buf: *u8, n: i64) -> i64
called by 1: g_measure
81func g_measure(spec: *u8, bin: *u8, serial: *u8) -> i64
89func g_hex(src: *u8, n: i64, dst: *u8) -> i64
called by 1: g_report
95func 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
96func 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 }
called by 1: g_report calls 1: sys_mmap
100func g_report(out: *u8, did: i64, cfg: *u8, steps: i64, priv: *u8, pub: *u8, corrupt: i64) -> i64
120func 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 }
123func g_fed_winner(inbox: *u8) -> i64
called by 1: main calls 3: g_run1sys_mmapg_read
142func 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
144func main() -> i64