code wiki / (root) / nx_substrate_manifest.nx

nx_substrate_manifest.nx

buildroot/runtime/nx_substrate_manifest.nx

10762 B274 linesdepth 6pulls 6 transitivereach 5 importersview sourcekind librarytopic substrate
docsdependenciesstructsconstsfunctions

about

nx_substrate_manifest.nx -- declared expected-blob set + completion tracking for the spore-up NETWORK phase. EM-3 partial milestone of NISHI_ECOSYSTEM_EVOLUTION_ROADMAP.md. The spore germinates with a "Merkle root" -- a set of expected blob hashes that together comprise the substrate it will assemble. This primitive captures that expected set + tracks which blobs have been received + verified, so the germination loop can terminate when all expected blobs are present. Transport-agnostic: this primitive doesn't care HOW bytes arrive (HTTPS / sneakernet / file / serial / Bluetooth). The caller hands received bytes + the hash they CLAIM the bytes match; this primitive verifies + stores + tracks. Composes: nx_blob_store -- where verified blobs land nx_sha256 -- hash verification (inside nx_blob_store_put) V1 scope: - Fixed-array expected-hash set (up to NX_SM_MAX_EXPECTED) - Per-hash received_flag: 0 (not yet) / 1 (received + verified) - Ingest verifies: hash matches expected AND expected is in manifest set (refuses unknown hashes -- closes the "peer can push arbitrary content" attack vector) - Idempotent re-ingest: ALREADY_RECEIVED is OK, not error - Canary-bracketed Deferred per roadmap: - Merkle-tree (not just flat set) for O(log n) inclusion proofs - Per-blob freshness timestamps (when did we receive it?) - Per-blob source attribution (which peer served it?) - Larger expected set (V1 caps at 64 expected blobs) genealogy_id: git_pack_index_2005 + ipfs_pinning_2015 + bittorrent_torrent_file_2001 + cardinal_2026-05-20_ecosystem_evolution lineage_id: substrate_manifest_v1 nx_capability_manifest:

dependencies 2 imports · 5 importers

nx_syscalls.nx nx_blob_store.nx nx_substrate_manifest.nx nx_emitted_substrate.nx nx_emitted_substrate_test.nx nx_spore_up_lifecycle_test.nx nx_spore_up_network_test.nx nx_substrate_manifest_test.nx

imports: nx_syscalls.nxnx_blob_store.nx

imported by: nx_emitted_substrate.nxnx_emitted_substrate_test.nxnx_spore_up_lifecycle_test.nxnx_spore_up_network_test.nxnx_substrate_manifest_test.nx

structs

91struct NxSubstrateManifest

consts

67const NX_SM_MAX_EXPECTED: i64 = 64
70const NX_SM_CANARY_PRE: i64 = 0x4E58534D414E5000 // "NXSMANP\0"
71const NX_SM_CANARY_POST: i64 = 0x4E58534D414E454E // "NXSMANEN"
74const NX_SM_INGESTED: i64 = 0 // first successful receive
75const NX_SM_ALREADY_RECEIVED: i64 = 1 // idempotent re-ingest
76const NX_SM_NOT_IN_MANIFEST: i64 = 2 // hash not in expected set
77const NX_SM_HASH_MISMATCH: i64 = 3 // bytes don't hash to claimed
78const NX_SM_BAD_INPUT: i64 = 4
79const NX_SM_BLOB_STORE_FULL: i64 = 5
80const NX_SM_TAMPER: i64 = 6
81const NX_SM_FULL: i64 = 7 // expected set too large
82const NX_SM_N_VERDICTS: i64 = 8

functions

84func nx_sm_verdict_is_valid(v: i64) -> i64
called by 1: main
105func nx_substrate_manifest_new(blob_store: *NxBlobStore) -> *NxSubstrateManifest
called by 4: mainmainmainmain calls 1: sys_mmap
128func nx_substrate_manifest_is_valid(m: *NxSubstrateManifest) -> i64
143func nx_substrate_manifest_add_expected(
178func _sm_find_expected_idx(m: *NxSubstrateManifest, hash: *NxBlobHash) -> i64
204func nx_substrate_manifest_ingest(
252func nx_substrate_manifest_is_complete(m: *NxSubstrateManifest) -> i64
260func nx_substrate_manifest_n_missing(m: *NxSubstrateManifest) -> i64
266func nx_substrate_manifest_n_rejected_unknown(m: *NxSubstrateManifest) -> i64
271func nx_substrate_manifest_n_rejected_tamper(m: *NxSubstrateManifest) -> i64