code wiki / (root) / nx_filehash_gate.nx

nx_filehash_gate.nx

buildroot/runtime/nx_filehash_gate.nx

9290 B161 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_filehash_gate.nx -- THE GATE FOR THE IDENTITY RULER. Every content pin in every /compare .refs register on this estate is a sha256 produced by nx_filehash, and every fetch-time provenance binding compares against one. On 2026-09-06 nx_catalog reported nx_filehash_gate ABSENT -- no source, no binary, nothing promoted -- so the ruler that decides whether two artifacts are the same bytes had no gate of its own. This is that gate. IT COMPOSES THE ORGAN'S OWN SELFTEST RATHER THAN RE-IMPLEMENTING IT (T8), because a second copy of the same five teeth would be the duplicate-ruler defect. What a GATE adds over a selftest is threefold and none of it is duplication: it forks the DEPLOYED ARTIFACT from outside rather than testing itself from within, it can be BITE-PROVEN by mutating the subject, and it is rostered so it runs on a beat instead of when a seat types it. THE INDEPENDENT VECTORS ARE THE POINT. T1 and T2 are published SHA-256 known answers this gate carries itself: "abc" and THE EMPTY INPUT. The empty case is the one an organ's own selftest most often omits and the one a length-driven bug survives, so it is here deliberately. If the organ and this gate ever disagree, the published vector wins -- that is what an external ruler is for. NEGATIVE CONTROLS, because a checker that returned success for everything would score 100 percent: T7 requires a MISSING file to yield NO digest at all, and T6 requires two DIFFERENT files to compare unequal. A gate whose every tooth asserts presence cannot tell a working ruler from one that prints a constant. Fixtures are assembled at RUNTIME under /tmp/nx_filehash_gate/ so this gate never shares scratch with a production beat, and T0 asserts the fixtures actually reached their intended bytes BEFORE any outcome is read off them. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_tool_run.nx nx_filehash_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_tool_run.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main gv_head gv_puts sys_write gv_ctr 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 ↻ sys_mkdir fhg_write sys_openat_wr sys_write ↻ sys_close gv_check_eq gv_check gv_puts ↻ gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻ sys_munmap sys_mmap ↻ fhg_run1 sys_mmap ↻ tr_run_capture sys_mmap ↻ sys_pipe2 sys_fork

structs

none

consts

26const FHG_DIR: *u8 = "/tmp/nx_filehash_gate"
27const FHG_ABC: *u8 = "/tmp/nx_filehash_gate/abc.txt"
28const FHG_ABC2: *u8 = "/tmp/nx_filehash_gate/abc2.txt"
29const FHG_ABD: *u8 = "/tmp/nx_filehash_gate/abd.txt"
30const FHG_EMPTY: *u8 = "/tmp/nx_filehash_gate/empty.txt"
31const FHG_MISSING: *u8 = "/tmp/nx_filehash_gate/no_such_file.txt"
32const FHG_ELF: *u8 = "nx_filehash.elf"
33const FHG_DIRMODE: i64 = 0x1ed
34const FHG_FILEMODE: i64 = 0x1a4
35const FHG_CAP: i64 = 16384
36const FHG_I64: i64 = 8
42const FHG_ARGV_SLOTS: i64 = 64
43const FHG_ABC_LEN: i64 = 3
45const FHG_KAT_ABC: *u8 = "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"
46const FHG_KAT_EMPTY: *u8 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"

functions

48func fhg_write(path: *u8, data: *u8, n: i64) -> i64
58func fhg_run1(a1: *u8, out: *u8, olen: *i64) -> i64
called by 1: main calls 2: sys_mmaptr_run_capture
68func fhg_run3(a1: *u8, a2: *u8, a3: *u8, out: *u8, olen: *i64) -> i64
called by 1: main calls 2: sys_mmaptr_run_capture
79func main(argc: i64, argv: *i64) -> i64