code wiki / (root) / nx_gcode_manifest.nx

nx_gcode_manifest.nx

buildroot/runtime/nx_gcode_manifest.nx

7448 B195 linesdepth 2pulls 3 transitivereach 46 importersview sourcekind librarytopic gcode
docsdependenciesstructsconstsfunctions

about

nx_gcode_manifest.nx -- per-print provenance manifest emitted as G-code header comments. Carries a BLAKE2b digest of every input to the slicer (mesh, config, machine graph, material profile, slicer commit) so a printed artefact -- or a failed print -- maps deterministically back to the exact slicer state. Per cardinal feedback-end-to-end-bit-traceability-architecture + roadmap NISHI_3D_PRINT_ROADMAP ยง2.5: no SOTA slicer in May 2026 (OrcaSlicer, PrusaSlicer, Bambu Studio, SuperSlicer) embeds source-mesh provenance in their G-code output. This is a clean- room EXCEED axis with no prior art to match against. Conceptually distinct from: - nx_provenance.nx -- license-class source gate (different role) - nx_attest.nx -- substrate-wide Merkle chain log (this primitive can be COMPOSED to feed the chain in a later phase; see P0.2 notes) Manifest format (human-readable text, valid G-code comments): ; NX_GCODE_MANIFEST_V1 ; mesh.blake2b <128 hex chars> ; config.blake2b <128 hex chars> ; machine.blake2b <128 hex chars> ; material.blake2b <128 hex chars> ; slicer.sha <substrate build hash, caller-supplied> ; manifest.blake2b <128 hex chars over all preceding lines> All hashes are BLAKE2b-512 (per substrate convention -- nx_blake2b is the shipped primitive; nx_blake3 is queued for a later session). Final "manifest.blake2b" line covers exactly the bytes of every preceding line in the buffer, making the manifest self-attesting: tampering with any earlier line breaks the final hash check. G-code consumers (Klipper, Marlin, RepRapFirmware, Bambu firmware) uniformly skip semicolon-prefixed lines -- this manifest has zero effect on print behaviour. license_tier: ORIGINAL

dependencies 2 imports · 2 importers

nx_syscalls.nx nx_blake2b.nx nx_gcode_manifest.nx nx_gcode_emit.nx nx_gcode_manifest_test.nx

imports: nx_syscalls.nxnx_blake2b.nx

imported by: nx_gcode_emit.nxnx_gcode_manifest_test.nx

structs

49struct NxGcodeManifest

consts

44const NX_GMANIFEST_MAX_BYTES: i64 = 4096
45const NX_GMANIFEST_DIGEST_LEN: i64 = 64 // BLAKE2b-512
57const NX_GMANIFEST_BYTES: i64 = 40

functions

62func gmanifest_blake2b_oneshot(msg: *u8, msg_len: i64,
73func nx_gmanifest_new() -> *NxGcodeManifest
called by 2: build_manifestmain calls 1: sys_mmap
95func nx_gmanifest_append_byte(m: *NxGcodeManifest, b: i64) -> i64
102func nx_gmanifest_append_cstr(m: *NxGcodeManifest, s: *u8) -> i64
113func nx_gmanifest_append_bytes(m: *NxGcodeManifest, src: *u8, n: i64) -> i64
125func nx_gmanifest_nibble_hex(n: i64) -> i64
132func nx_gmanifest_append_hex(m: *NxGcodeManifest, src: *u8, n: i64) -> i64
150func nx_gmanifest_add(m: *NxGcodeManifest, key: *u8, digest: *u8, digest_len: i64) -> i64
163func nx_gmanifest_add_blob(m: *NxGcodeManifest, key: *u8, blob: *u8, blob_len: i64) -> i64
175func nx_gmanifest_finalize(m: *NxGcodeManifest) -> i64
190func nx_gmanifest_write(m: *NxGcodeManifest, dst: *u8, dst_capacity: i64) -> i64