code wiki / _hdl_build / nx_sov_ledger_gate.nx
nx_sov_ledger_gate.nx
buildroot/runtime/_hdl_build/nx_sov_ledger_gate.nx
about
nx_sov_ledger_gate.nx -- proves the canonical sovereign ledger nx_sov_ledger.nx.
Oracle = round-trip identity on a REAL nx_seg_store (write -> read -> equal), incl the typed-binary
record format and the anti-fabrication neg-controls. Per-run isolated prefix (sys_now_us suffix) so the
gate is idempotent/deterministic across runs (rule 10) and demonstrates the segid discipline.
T1 KV round-trip (put str -> get_copy equal)
T2 latest-wins (second put overwrites; newest value returned)
T3 existence: sov_has present=1, absent=0 (neg control -- never a false present)
T4 typed int record: put_ints [3675,1093,472,45,216] -> get_ints returns exactly those (no delimiters)
T5 anti-fabrication: get_ints of an absent key -> -1 (never invents a record)
Read-only-to-the-world (writes ONLY into its own sovereign store prefix, not a flat side-car). GREEN iff
all pass. Sovereign nx_cc->nxasm; CWD=nxc2 root. expect_exit: 0 license_tier: ORIGINAL
dependencies 3 imports · 0 importers
imports: nx_sov_ledger.nxnx_seg_store.nxnx_syscalls.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
| 16 | func lg_w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 17 | func lg_n(v: i64) -> i64 { let b: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i: i64=0; while i<k{b[i]=t[k-1-i];i=i+1}; sys_write(1,b,k); return 0 } |
| 18 | func lg_cat(dst: *u8, off: i64, s: *u8) -> i64 { var o: i64=off; var k: i64=0; while s[k]!=(0 as u8){dst[o]=s[k];o=o+1;k=k+1} return o } called by 1: main |
| 19 | func lg_num(dst: *u8, off: i64, v: i64) -> i64 { var o: i64=off; let t: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m}; var k: i64=0; if m==0{t[0]=48 as u8;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i: i64=0; while i<k{dst[o]=t[k-1-i];o=o+1;i=i+1} return o } |
| 20 | func lg_streq(a: *u8, an: i64, b: *u8) -> i64 { let bn: i64=sov_slen(b); if an!=bn { return 0 } var i: i64=0; while i<an { if a[i]!=b[i] { return 0 } i=i+1 } return 1 } |
| 22 | func main() -> i64 |