code wiki / _hdl_build / nx_ingest_foundation.nx

nx_ingest_foundation.nx

buildroot/runtime/_hdl_build/nx_ingest_foundation.nx

7223 B142 linesdepth 10pulls 16 transitivereach 5 importersview sourcekind librarytopic ingest
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_canon_cid.nx nx_asset_provenance.nx nx_ed25519_signature.nx nx_ingest_foundation.nx nx_ciaaw_foundation.nx nx_codata_foundation.nx nx_isotope_foundation.nx nx_library_foundation.nx nx_library_foundation_gate.nx

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

15const IF_MAGIC_262144: i64 = 262144
16const IF_MAGIC_8192: i64 = 8192
17const IF_MAGIC_131072: i64 = 131072
19const IF_LINEAGE: *u8 = "knowledge/registry/genesis_lineage.tsv"

functions

21func 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 }
called by 1: ingest_foundation calls 1: sys_write
22func 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 }
called by 1: ingest_foundation calls 2: sys_mmapsys_write
24func if_read(path: *u8, buf: *u8, cap: i64) -> i64
33func 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 }
called by 2: if_parentif_to_god
34func if_field(buf: *u8, ls: i64, le: i64, col: i64, dst: *u8) -> i64
called by 1: if_parent
44func if_parent(buf: *u8, n: i64, id: *u8, par: *u8) -> i64
called by 1: if_to_god calls 3: sys_mmapif_fieldif_streq
61func if_to_god(buf: *u8, n: i64, start: *u8) -> i64
75func ingest_foundation(raw_path: *u8, source: *u8, date: *u8, agent: *u8, cred_path: *u8, log_path: *u8, logtag: *u8, cid_out: *u8) -> i64