code wiki / _hdl_build / nx_ingest_foundation.nx
nx_ingest_foundation.nx
buildroot/runtime/_hdl_build/nx_ingest_foundation.nx
about
nx_ingest_foundation.nx -- REUSABLE foundationing library (rule-of-three extraction: nx_codata_foundation
and nx_isotope_foundation were near-identical clones). One function FOUNDATIONS any ingested external
dataset per the operator law "if we consume we need to trace and build its lineage properly back to god":
(1) CONTENT-ADDRESS -> nx_canon_cid cid_of (nxc1-... sha256 identity, tamper-evident).
(2) SIGNED PROVENANCE -> nx_asset_provenance: ed25519 "downloaded" credential binding entity=CID + agent
+ source-URL + fetch-date; deny-by-default verify; 3 liar-kills (flip / wrong-key / re-bind).
(3) LINEAGE TO GOD -> external data enters ONLY via the sovereign researcher (UNI-WIRE); walk
genesis_lineage from UNI-WIRE to ORIGIN(god) and assert it reaches god.
GREEN (returns 1) iff verify ALLOWs, all 3 tampers REJECT, and the transport lineage reaches god. Writes
the sovereign NXPC1 credential blob + a log line tagged by the caller. No main -- pure library. license_tier: ORIGINAL
dependencies 4 imports · 5 importers
imports: nx_syscalls.nxnx_canon_cid.nxnx_asset_provenance.nxnx_ed25519_signature.nx
imported by: nx_ciaaw_foundation.nxnx_codata_foundation.nxnx_isotope_foundation.nxnx_library_foundation.nxnx_library_foundation_gate.nx
structs
| none |
consts
| 15 | const IF_MAGIC_262144: i64 = 262144 |
| 16 | const IF_MAGIC_8192: i64 = 8192 |
| 17 | const IF_MAGIC_131072: i64 = 131072 |
| 19 | const IF_LINEAGE: *u8 = "knowledge/registry/genesis_lineage.tsv" |
functions
| 21 | func if_w(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 } |
| 22 | func if_wn(fd: i64, v: i64) -> i64 { let b: *u8=sys_mmap(16); var m: i64=v; let t: *u8=sys_mmap(16); 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(fd,b,k); return 0 } |
| 24 | func if_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 33 | func if_streq(a: *u8, b: *u8) -> i64 { var i: i64=0; while a[i]!=(0 as u8){ if a[i]!=b[i]{return 0} i=i+1 } if b[i]!=(0 as u8){return 0} return 1 } |
| 34 | func if_field(buf: *u8, ls: i64, le: i64, col: i64, dst: *u8) -> i64 called by 1: if_parent |
| 44 | func if_parent(buf: *u8, n: i64, id: *u8, par: *u8) -> i64 |
| 61 | func if_to_god(buf: *u8, n: i64, start: *u8) -> i64 |
| 75 | func ingest_foundation(raw_path: *u8, source: *u8, date: *u8, agent: *u8, cred_path: *u8, log_path: *u8, logtag: *u8, cid_out: *u8) -> i64 |