code wiki / (root) / nx_ledger_trust_equiv_gate.nx

nx_ledger_trust_equiv_gate.nx

buildroot/runtime/nx_ledger_trust_equiv_gate.nx

7180 B161 linesdepth 8pulls 14 transitivereach 0 importersview sourcekind gate/prooftopic ledger
docsdependenciesstructsconstsfunctions

about

nx_ledger_trust_equiv_gate.nx -- F997 STEP 1: BEHAVIOUR-EQUIVALENCE PROOF, nx_ledger vs nx_trust. F997 wants nx_trust (IOLTA, RPC 1.15, LIVE and gate-proven 7/7) re-based onto the new nx_ledger primitive. Rewriting a working compliance organ on faith is exactly how you break a bar-audit surface. So this gate does the SAFE half first: it drives the SAME scenario through BOTH implementations and asserts they agree, value for value. nx_trust is NOT modified. If every assertion holds, the re-base is proven safe and F997's real edit becomes mechanical. If any fails, we have found a genuine semantic gap in the primitive BEFORE trusting money to it. (This is the D001 organ-dedup behaviour-equivalence discipline applied to money.) MAPPING (trust semantics -> double-entry): deposit $X for client C == transfer bank -> client:C (credits C) disburse $X for client C == transfer client:C -> operating (debits C) client balance == led_balance(client) = credits - debits (same custodial sense) RPC 1.15 no-overdraw == led_can_fund(client, X) three-way reconciliation == sum(per-client balances) == trust account total license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 2 imports · 0 importers

nx_trust_lib.nx nx_ledger_lib.nx nx_ledger_trust_equiv_gate.nx

imports: nx_trust_lib.nxnx_ledger_lib.nx

imported by: nobody (leaf or entry point)

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

main sys_now_us sys_mmap sys_clock_gettime_mono eq_id mt_catcopy mt_catn eq_puts trust_put mt_catcopy ↻ mt_catn ↻ canon_encode sys_mmap ↻ cc_cmp cc_w32 cc_len sys_munmap reg_put reg_put_x sts_lock sts_mm sys_mmap ↻ sts_werr sys_exit ss_cat sys_openat_append sts_werr ↻ sys_flock reg_key reg_cat ss_get sys_mmap ↻ ss_scan sys_mmap ↻ ss_manifest_dyn ss_scan_seglist reg_strlen reg_id_present sts_unlock sys_flock ↻

structs

none

consts

none

functions

23func eq_puts(s: *u8) -> i64
called by 2: eq_ckmain
29func eq_putn(v: i64) -> i64
called by 2: eq_ckmain
44func eq_ck(cnt: *i64, name: *u8, trust_v: i64, ledger_v: i64, want: i64) -> i64
called by 1: main calls 2: eq_putseq_putn
60func eq_id(tag: *u8, nonce: i64, out: *u8) -> i64
called by 1: main calls 2: mt_catcopymt_catn
67func main(argc: i64, argv: *i64) -> i64