code wiki / (root) / nx_cdc_gate.nx

nx_cdc_gate.nx

buildroot/runtime/nx_cdc_gate.nx

9289 B157 linesdepth 6pulls 7 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_cdc_gate.nx -- IN-PROCESS gate over nx_cdc_lib (/compare/dataio DI5 cp_cdc_gear): content-defined chunking must (1) partition the input within its declared bounds, (2) be deterministic, (3) survive an INSERTION with almost every chunk digest intact while the fixed-size CONTROL loses almost every chunk after the edit -- that pair is the whole claim, and neither half alone proves it -- and (4) refuse parameters that are not a chunking. The corpus is a pseudo-random 1 MiB buffer from a seeded xorshift generator (no file, no clock), the parameters are the ones nx_content_put derives from its wire chunk (48,402 -> max 48402, avg 24201, min 6050). exit: 0 GREEN / 1 RED (gv_verdict law).

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_sha256.nx nx_cdc_lib.nx nx_cdc_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_sha256.nxnx_cdc_lib.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main gv_ctr sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ gv_head gv_puts sys_write ↻ sys_mmap ↻ gv_check_eq gv_check gv_puts ↻ gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻ sys_munmap cdc_gear_table cdc_slen sys_mmap ↻ sha256_digest sys_mmap ↻ sha256_init sys_mmap ↻ sha256_seed_allocated sha256_k sha256_update sha256_compress_ni_blocks

structs

none

consts

13const CG_N: i64 = 1048576
14const CG_SEED: i64 = 88172645463325252
15const CG_MAX: i64 = 48402
16const CG_AVG: i64 = 24201
17const CG_MIN: i64 = 6050
18const CG_CAP: i64 = 4096 // plan table slots: 1 MiB / min 6050 = 174 chunks at most; 4096 is headroom, and the refusal on overflow is tested
19const CG_INS_AT: i64 = 100000
20const CG_INS_LEN: i64 = 37
21const CG_TOL: i64 = 3 // chunks that may legitimately re-key around one insertion: the one cut and its two neighbours
27const CG_KAT_CHUNKS: i64 = 43

functions

30func cg_fill(buf: *u8, n: i64, seed: i64) -> i64
called by 1: main
44func cg_digests(buf: *u8, offs: *i64, count: i64, out: *u8) -> i64
called by 1: main calls 1: cdc_chunk_digest
50func main() -> i64