code wiki / _hdl_build / nx_apertus_shard_verify.nx
nx_apertus_shard_verify.nx
buildroot/runtime/_hdl_build/nx_apertus_shard_verify.nx
about
nx_apertus_shard_verify.nx -- SOVEREIGN fail-closed verify of the streamed Apertus shards: for each .part file on
the NAS, stream-hash it with nx_sha256 (8MB window, no full buffer) and compare to the shard's lfs.oid (from the
sovereign enumerate nx_apertus_tree_parse). Match -> rename .part -> final (the shard is now a trusted, byte-exact
mirror). Mismatch -> leave .part (REJECTED; a corrupt/truncated stream is NEVER promoted). NO TLS import -> no M32
clash with the fetch/streaming path. license_tier: ORIGINAL expect_exit: 0
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_sha256.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
| 8 | const K_MAGIC_8388608: i64 = 8388608 |
| 9 | const K_MAGIC_1024: i64 = 1024 |
functions
| 11 | func w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 12 | func wn(v: i64) -> i64 { var m: i64=v; if m<0{w("-" as *u8);m=0-m} let t:*u8=sys_mmap(24); 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; let o:*u8=sys_mmap(24); while i<k{o[i]=t[k-1-i];i=i+1} sys_write(1,o,k); return 0 } |
| 13 | func sv_cat(dst: *u8, off: i64, s: *u8) -> i64 { var o: i64=off; var i: i64=0; while s[i]!=(0 as u8){dst[o]=s[i];o=o+1;i=i+1} return o } called by 1: main |
| 14 | func sv_streq(a: *u8, b: *u8) -> i64 { var i: i64=0; while 1==1 { if a[i]!=b[i] {return 0} if a[i]==(0 as u8) {return 1} i=i+1 } return 1 } called by 1: main |
| 15 | func sv_hexenc(inp: *u8, n: i64, out: *u8) -> i64 { let hx: *u8="0123456789abcdef" as *u8; var i: i64=0; while i<n { out[i*2]=hx[((inp[i] as i64)>>4)&15]; out[i*2+1]=hx[(inp[i] as i64)&15]; i=i+1 } out[n*2]=0 as u8; return n*2 } called by 1: sv_hash_file |
| 18 | func sv_hash_file(path: *u8, out_hex: *u8) -> i64 |
| 35 | func main() -> i64 |