code wiki / (root) / nx_sov_census_test.nx

nx_sov_census_test.nx source

↩ module page · 43 lines · 2193 B

1// nx_sov_census_test.nx -- sovereign gate for the 3rd-party-dependency census. 2// Proves each axis flags its 3rd-party marker and passes sovereign source, the 3// permil moves, and the runtime axis is honest. Exit = failed assertion #. 4 5import "nx_syscalls.nx" 6import "nx_sov_census.nx" 7 8func main() -> i64 { 9 let py_db: *u8 = "import sqlite3\nconn = sqlite3.connect('catalog.db')" as *u8 10 let py_http: *u8 = "import httpx\nr = httpx.post(url)" as *u8 11 let py_val: *u8 = "from pydantic import BaseModel" as *u8 12 let py_pdf: *u8 = "from docling.document_converter import DocumentConverter" as *u8 13 let html_map:*u8 = "<script src=\"static/vendor/leaflet/leaflet.js\"></script>" as *u8 14 let nx_clean:*u8 = "func main() -> i64 { return 0 }" as *u8 15 16 // each axis flags its 3rd-party marker (0 = gap) 17 if soc_db_sov(py_db, uxg_len(py_db)) != 0 { return 1 } 18 if soc_http_sov(py_http, uxg_len(py_http)) != 0 { return 2 } 19 if soc_validation_sov(py_val, uxg_len(py_val)) != 0 { return 3 } 20 if soc_pdf_sov(py_pdf, uxg_len(py_pdf)) != 0 { return 4 } 21 if soc_map_sov(html_map, uxg_len(html_map)) != 0 { return 5 } 22 23 // sovereign source passes every axis (1 = sovereign) 24 if soc_db_sov(nx_clean, uxg_len(nx_clean)) != 1 { return 6 } 25 if soc_http_sov(nx_clean, uxg_len(nx_clean)) != 1 { return 7 } 26 if soc_validation_sov(nx_clean, uxg_len(nx_clean)) != 1 { return 8 } 27 if soc_pdf_sov(nx_clean, uxg_len(nx_clean)) != 1 { return 9 } 28 if soc_map_sov(nx_clean, uxg_len(nx_clean)) != 1 { return 10 } 29 30 // runtime axis is honest: .nx sovereign, python/js not 31 if soc_runtime_sov(1) != 1 { return 11 } 32 if soc_runtime_sov(0) != 0 { return 12 } 33 34 // permil: all-sovereign = 1000, all-3rd-party = 0, mixed in between 35 if soc_permil(1, 1, 1, 1, 1, 1) != 1000 { return 13 } 36 if soc_permil(0, 0, 0, 0, 0, 0) != 0 { return 14 } 37 if soc_permil(1, 1, 1, 0, 0, 0) >= soc_permil(1, 1, 1, 1, 1, 1) { return 15 } 38 if soc_permil(0, 0, 0, 0, 0, 0) >= soc_permil(1, 1, 1, 0, 0, 0) { return 16 } 39 40 let msg: *u8 = "nx_sov_census: 16/16 sovereign assertions PASS (native, hardware-up)\n" as *u8 41 sys_write(1, msg, uxg_len(msg)) 42 return 0 43}