nx_fin_ledger_gate.nx
buildroot/runtime/nx_fin_ledger_gate.nx
about
nx_fin_ledger_gate.nx -- R2 GATE: proves the double-entry ledger is exact, append-only, idempotent,
and never records a corrupt (unbalanced) entry. Dogfooded on the operator's HELOC crisis:
accounts: Home(asset), HELOC(liability), Cash(asset), OpeningEquity(equity), InterestExpense(expense)
txn1 opening balances -> net worth = Home + Cash + HELOC(neg) = $210,000.00
txn2 HELOC paydown $5,000 from Cash -> net worth INVARIANT (asset down == liability up) = THE PROOF
txn3 HELOC interest $1,000 from Cash -> net worth DOWN by $1,000 (expense, no offset)
Then: unbalanced txn REJECTED + never recorded (never-brick); re-post = idempotent DUP; history
retrievable + intact; and the live HELOC balance feeds nx_money for an exact monthly-interest figure.
Hermetic: a fresh per-run /tmp prefix, so the gate never touches the real ledger store.
Exits 0 iff ALL pass. license_tier: ORIGINAL
dependencies 5 imports · 0 importers
imports: nx_syscalls.nxnx_money.nxnx_canon_cid.nxnx_uxf_decode.nxnx_fin_ledger.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| none |
functions
| 17 | func g_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 18 | func g_putn(v: i64) -> i64 |
| 28 | func chk(name: *u8, got: i64, want: i64, st: *i64) -> i64 |
| 34 | func main() -> i64 |