code wiki / _hdl_build / nx_extvec_authentic_gate.nx

nx_extvec_authentic_gate.nx

buildroot/runtime/_hdl_build/nx_extvec_authentic_gate.nx

16626 B351 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_extvec_authentic_gate.nx -- THE GUARD THAT WOULD HAVE CAUGHT IT ON DAY ONE, PLUS THE LEDGER. ★★★★★ THE LAW THIS GATE ENFORCES: A DIGEST PIN PROVES INTEGRITY-SINCE-FETCH, NOT AUTHENTICITY-AT-SOURCE. Every external-vector gate pins its source document to a SHA-256 computed in-process at the socket and treats "PIN OK" as if it established that the bytes ARE the authority's document. It does not. A pin proves only that the bytes have not changed since we hashed them. A corrupted, truncated, or -- as actually happened on 2026-07-31 -- a fetch that stored the raw HTTP WIRE TRANSCRIPT instead of the document, all pin exactly as cleanly as a good one. The pin is self-consistent BY CONSTRUCTION, so no amount of re-checking the pin can ever reveal the fault. ★INDEPENDENCE NEEDS A SECOND STACK, NOT A SECOND HASH. ⚠THE DEFECT THIS EXISTS TO PREVENT: knowledge/extvec/rfc2202.txt began HTTP/1.1 200 OK\r\nDate: ...\r\nTransfer-Encoding: chunked\r\n ... \r\n\r\n2ea6\r\n -- 707 bytes of response headers plus chunk framing -- because nx_vecfetch called the raw nx_https_get, which BY CONTRACT returns the entire response, and never stripped headers or de-chunked. All 14 pinned "authority documents" were transcripts. The shared decoder (nx_fetch_staged / fu_dechunk in nx_fetch_unit.nx) already existed and was not adopted. ★THE ADOPTION GAP, NOT A MISSING PRIMITIVE. TWO INDEPENDENT CHECKS, AND THEY FAIL FOR DIFFERENT REASONS -- THAT IS THE POINT: A. SHAPE -- is this file a document rather than a transcript? (content predicate, no external input) B. LEDGER -- does an independent stack agree on this exact file's digest? (corroboration, external) A catches the accident. B catches the substitution. A file can pass A and fail B (a DIFFERENT but well-formed document swapped in), or pass B and fail A (both stacks fetched the same transcript). ★A SINGLE CHECK THAT COULD HAVE CAUGHT BOTH WOULD HAVE CAUGHT NEITHER CLEANLY. ⚠HONEST LIMIT OF THE LEDGER, STATED SO NOBODY OVER-TRUSTS IT: CORROBORATION.tsv is a plain file this agent can write. It raises the bar -- swapping a document now requires forging a matching "independent" column, at which point that column is no longer independent and the forgery is recorded in-tree rather than invisible -- but it is NOT a transparency log. The July-2026 answer to that is Sigstore/Fulcio/Rekor or in-toto/DSSE: an append-only log held by a party we cannot edit. Nishi already has nx_coe_dsse / nx_coe_intoto / nx_coe_witness and this lane has NOT adopted them. That is the next rung, not this one. license_tier: ORIGINAL expect_exit: 0

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_sha256_wasm.nx nx_gate_verdict.nx nx_extvec_authentic_gate.nx

imports: nx_syscalls.nxnx_sha256_wasm.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

main w sys_write sys_mmap nxa_die sys_write ↻ sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ gv_ctr sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close gv_check gv_puts sys_write ↻ gv_verdict gv_note_bare_rate gv_bare_rate gv_at gv_obj_has_n gv_at ↻ gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻

structs

none

consts

116const F_OK: i64 = 0
117const F_STATUSLINE: i64 = 1
118const F_HDR_TE: i64 = 2
119const F_HDR_CL: i64 = 3
120const F_HDR_BREAK: i64 = 4
121const F_CR: i64 = 5
147const L_OK: i64 = 0
148const L_NOROW: i64 = 1
149const L_SOVMISS: i64 = 2
150const L_INDEPMISS: i64 = 3
151const L_NOTAGREED: i64 = 4
152const L_SHORT: i64 = 5

functions

38func 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 4: nnfaultnameledgernamemain calls 1: sys_write
39func wb(b: *u8, n: i64) -> i64 { sys_write(1, b, n); return 0 }
calls 1: sys_write
41func nn(v: i64) -> i64
called by 1: main calls 3: wsys_mmapsys_write
55func hexnib(v: i64) -> i64 { if v < 10 { return 48 + v } return 87 + v }
called by 1: hexdig
57func starts(b: *u8, n: i64, at: i64, s: *u8) -> i64
67func findfrom(b: *u8, n: i64, s: *u8, from: i64) -> i64
called by 1: ledger_check calls 1: starts
76func lc(c: i64) -> i64 { if c >= 65 { if c <= 90 { return c + 32 } } return c }
called by 2: find_ciledger_check
77func find_ci(b: *u8, n: i64, lim: i64, s: *u8) -> i64
called by 1: transcript_fault calls 1: lc
94func count_byte(b: *u8, n: i64, v: i64) -> i64
called by 1: transcript_fault
101func mkpath(name: *u8, out: *u8) -> i64
called by 1: main
123func transcript_fault(b: *u8, n: i64) -> i64
called by 1: main calls 3: startsfind_cicount_byte
136func faultname(f: i64) -> i64
called by 1: main calls 1: w
157func ledger_check(led: *u8, ln: i64, name: *u8, filedig: *u8) -> i64
called by 1: main calls 4: sys_mmapfindfromlcstarts
197func ledgername(f: i64) -> i64
called by 1: main calls 1: w
207func hexdig(b: *u8, n: i64, out: *u8) -> i64
221func main() -> i64