nx_gcode_manifest.nx
buildroot/runtime/nx_gcode_manifest.nx
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
imports: nx_syscalls.nxnx_blake2b.nx
imported by: nx_gcode_emit.nxnx_gcode_manifest_test.nx
structs
| 49 | struct NxGcodeManifest |
consts
| 44 | const NX_GMANIFEST_MAX_BYTES: i64 = 4096 |
| 45 | const NX_GMANIFEST_DIGEST_LEN: i64 = 64 // BLAKE2b-512 |
| 57 | const NX_GMANIFEST_BYTES: i64 = 40 |
functions
| 62 | func gmanifest_blake2b_oneshot(msg: *u8, msg_len: i64, |
| 73 | func nx_gmanifest_new() -> *NxGcodeManifest |
| 95 | func nx_gmanifest_append_byte(m: *NxGcodeManifest, b: i64) -> i64 |
| 102 | func nx_gmanifest_append_cstr(m: *NxGcodeManifest, s: *u8) -> i64 |
| 113 | func nx_gmanifest_append_bytes(m: *NxGcodeManifest, src: *u8, n: i64) -> i64 |
| 125 | func nx_gmanifest_nibble_hex(n: i64) -> i64 called by 1: nx_gmanifest_append_hex |
| 132 | func nx_gmanifest_append_hex(m: *NxGcodeManifest, src: *u8, n: i64) -> i64 |
| 150 | func nx_gmanifest_add(m: *NxGcodeManifest, key: *u8, digest: *u8, digest_len: i64) -> i64 called by 1: nx_gmanifest_add_blob calls 3: nx_gmanifest_append_cstrnx_gmanifest_append_hexnx_gmanifest_append_byte |
| 163 | func nx_gmanifest_add_blob(m: *NxGcodeManifest, key: *u8, blob: *u8, blob_len: i64) -> i64 |
| 175 | func nx_gmanifest_finalize(m: *NxGcodeManifest) -> i64 |
| 190 | func nx_gmanifest_write(m: *NxGcodeManifest, dst: *u8, dst_capacity: i64) -> i64 |