code wiki / _hdl_build / nx_vizsla_budget_gate.nx

nx_vizsla_budget_gate.nx

buildroot/runtime/_hdl_build/nx_vizsla_budget_gate.nx

12875 B316 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind gate/prooftopic vizsla
docsdependenciesstructsconstsfunctions

about

nx_vizsla_budget_gate.nx -- VIZSLA V1 gate: the budget ledger is gate-proven against a HAND-TOTALED fixture month (construction-known sums; the oracle is arithmetic done by hand in this file's comments, not the module under test). Fixture store lives under an epoch-unique /tmp prefix => every run starts on a virgin store AND the module's prefix-derived log keeps fixtures out of the family ledger log (isolation by construction). month1 (segid 1001), hand-totaled: rent 120000 | groceries 4500+6250+3250=14000 | dining 2200+5800=8000 | fun 999 => total txns=7 spent=142999; env rent=120000 OK(0), groceries=15000 OK(+1000), dining=7500 OVER(-500); fun UNBUDGETED(-999) month2 (segid 1002): rent 120000 + groceries 5100 + dining 1500 = 126600 => ALL: groceries 19100, txns=10, spent=269599 Rows: 1 loud-fail missing txn file => exit 1 2 load-month1 scanned=7 new=7 committed seg-1001 3 hand-totaled groceries row exact + TOTAL txns=7 spent=142999 4 envelope-over dining delta=-500 state=OVER 5 unbudgeted fun named state=UNBUDGETED (never silently dropped) 6 idempotent re-load month1 => new=0 dup_instore=7 segment=none (law 10) 7 additive-month2 month2 lands; ALL report groceries=19100 txns=10 8 TIME-TRAVEL report asof=1001 AFTER month2 == byte-identical pre-month2 report 9 determinism ALL report twice => byte-identical 10 verify-clean CID recompute over 10 entries => verdict=CLEAN exit 0 11 TAMPER-EVIDENCE one flipped byte in seg-1002.docs => verdict=TAMPERED exit 1 Evidence: VIZSLA-BUDGET-GATE line -> stdout + knowledge/status/vizsla_gate.log; exit 0 iff 11/11. spec: knowledge/specs/2026-06-10-nishi-vizsla-ladder.md license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_vizsla_budget_gate.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main bg_p sys_write bg_slen sys_openat_rd sys_close bg_run sys_fork sys_openat_wr sys_dup3 sys_mmap sys_execve sys_exit sys_wait4 sys_mmap ↻ bg_cat bg_catn sys_mmap ↻ sys_now_us sys_mmap ↻ sys_clock_gettime_mono bg_write sys_openat_wr ↻ sys_write ↻ bg_slen ↻ sys_close ↻ bg_row bg_p ↻ bg_has sys_mmap ↻ bg_readall sys_openat_rd ↻ sys_lseek sys_mmap ↻ sys_read sys_close ↻ bg_slen ↻ bg_fileeq sys_mmap ↻ bg_readall ↻

structs

none

consts

none

functions

32func bg_slen(s: *u8) -> i64
called by 3: bg_pbg_writebg_has
38func bg_p(s: *u8) -> i64
called by 2: bg_rowmain calls 2: sys_writebg_slen
43func bg_cat(dst: *u8, off: i64, s: *u8) -> i64
called by 1: main
49func bg_catn(dst: *u8, off: i64, v: i64) -> i64
called by 1: main calls 1: sys_mmap
62func bg_write(path: *u8, content: *u8) -> i64
70func bg_readall(path: *u8, szout: *i64) -> *u8
88func bg_run(elf: *u8, a1: *u8, a2: *u8, a3: *u8, a4: *u8, outpath: *u8) -> i64
115func bg_has(path: *u8, needle: *u8) -> i64
called by 1: main calls 3: sys_mmapbg_readallbg_slen
134func bg_fileeq(p1: *u8, p2: *u8) -> i64
called by 1: main calls 2: sys_mmapbg_readall
150func bg_flip(path: *u8, fromend: i64) -> i64
164func bg_row(name: *u8, pass: i64) -> i64
called by 1: main calls 1: bg_p
171func main(argc: i64, argv: *i64) -> i64