code wiki / _hdl_build / _race6_register.nx

_race6_register.nx source

↩ module page · 40 lines · 3261 B

1// _race6_register.nx -- records the grammar-file Adversary + autonomy race 6. Engineer gate = 2// team-authored v3 KAT green (_pe_png_test) + locator KAT (_pe_pnghdr_test). Librarian alloc + 3// dual-write. license_tier: ORIGINAL 4import "nx_cap_register.nx" 5import "nx_capreg_librarian.nx" 6import "nx_syscalls.nx" 7 8func r6r_run(path: *u8) -> i64 { 9 let pid: i64 = sys_fork() 10 if pid == 0 { 11 let dn: i64 = sys_openat_wr("/dev/null" as *u8, 0x1a4) 12 if dn >= 0 { sys_dup3(dn, 1, 0); sys_dup3(dn, 2, 0) } 13 let argv: *i64 = sys_mmap(32) as *i64; argv[0] = path as i64; argv[1] = 0 14 let envp: *i64 = sys_mmap(16) as *i64; envp[0] = 0 15 sys_execve(path, argv, envp); sys_exit(127) 16 } 17 let st: *i64 = sys_mmap(16) as *i64 18 sys_wait4(pid, st, 0) 19 return st[0] 20} 21 22func main() -> i64 { 23 var allok: i64 = 1 24 if r6r_run("/tmp/_pe_png_test.sov.elf" as *u8) != 0 { allok = 0 } 25 if r6r_run("/tmp/_pe_pnghdr_test.sov.elf" as *u8) != 0 { allok = 0 } 26 cr_w(1, "ENGINEER: team-authored v3 KATs pass=" as *u8); cr_wn(1, allok); cr_w(1, "\n" as *u8) 27 let eng: i64 = ig_engineer(1, 1, 1, allok) 28 let dec: i64 = ig_decision(eng, ig_council(eng, 1, 1, 2), 1) 29 if dec != IG_INGEST { cr_w(1, "HELD\n" as *u8); sys_exit(1) } 30 if cr_can_register(5, 2, 6, dec) != 1 { cr_w(1, "REFUSED\n" as *u8); sys_exit(1) } 31 let lp: *u8 = "/tmp/nishi_cap_registry.log" as *u8 32 let jp: *u8 = "knowledge/status/cap_registry_durable.log" as *u8 33 let idx: i64 = cl_next_idx(lp, jp) 34 let ok: i64 = cl_register_dual(lp, jp, idx, 5, 35 2, "SELF ADVERSARY GRAMMAR-FILE v2 + AUTONOMY RACE 6 -- a NEW race is now a DATA FILE (zero organ recompile). nx_adversary_suite v2 parses a container grammar (hdr magic4/size4/skip rows, chunk shape type_w/len_w/type_first/len_le/pad2/trail_w, count/scalar/watch keys, chunk table, lanes) and stages the full suite from it: construction-known wants incl. scalar READ-BACK from the built image, the fixed perturbation taxonomy, manifest + tampered twin. PROOF OF EQUIVALENCE: knowledge/specs/race_riff.suite reproduces the CAPREG324 suite exactly (all 25 wants identical, referee 1000v1000). RACE 6 = knowledge/specs/race_png.suite, a NEW assignment (PNG chunk census: 8-byte magic = two MAGIC4 locator rows, length-first BE, 4-byte per-chunk CRC trail, IHDR-width scalar) staged with referee/organ/emitters UNTOUCHED. 6a covered-shapes team lane = 680 permil LANE0-BEHIND; ALL 8 lost rows named ONE concept (trailing field after body). emit7 v3: trail_w spec param (bounds + advance include trail; trail=0 reproduces v2; rail trail_w<=8 proven). 6b: re-authored _pe_png (same corename -> lane untouched) = 1000v1000 LANE0-MATCHES; tamper twin RED at named row. Sixth consecutive parity; second consecutive race with suite AND lane fully team-authored; Claude touch = the grammar FILE. PARSER LAW APPLIED: flag-based tokenizer (rh_tok pattern), per-line helper keeps ifs flat (4-deep nested-if landmine). Composes CAPREG324/287/292" as *u8) 36 if ok != 1 { cr_w(1, "DUAL-WRITE FAILED\n" as *u8); sys_exit(1) } 37 cr_w(1, "CAPREG idx=" as *u8); cr_wn(1, idx); cr_w(1, " REGISTERED -- grammar-file Adversary + race 6 grow-to-match 680->1000\n" as *u8) 38 sys_exit(0) 39 return 0 40}