code wiki / _hdl_build / nx_hub_replicate_gate.nx

nx_hub_replicate_gate.nx

buildroot/runtime/_hdl_build/nx_hub_replicate_gate.nx

4137 B66 linesdepth 7pulls 10 transitivereach 0 importersview sourcekind gate/prooftopic hub
docsdependenciesstructsconstsfunctions

about

nx_hub_replicate_gate.nx -- proves HUB-TO-HUB replication end to end: hub B (empty) learns hub A's index via gossip, PULLS the bytes B lacks, VERIFIES each replica's SHA-256 against the advertised content-id (fail-closed), adopts them, and becomes a new source. Also proves a content/cid MISMATCH is rejected (a hostile source cannot poison the mesh). Composes nx_gossip + nx_hub_replicate + nx_dist_index + nx_dist_publish. expect_exit: 0 license_tier: ORIGINAL

dependencies 6 imports · 0 importers

nx_hub_replicate.nx nx_g_puts_lib.nx nx_gossip.nx nx_dist_index.nx nx_dist_publish.nx nx_syscalls.nx nx_hub_replicate_gate.nx

imports: nx_hub_replicate.nxnx_g_puts_lib.nxnx_gossip.nxnx_dist_index.nxnx_dist_publish.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main g_puts sys_write sys_mmap g_fix sys_openat_wr sys_write ↻ sys_close dp_content_id sys_mmap ↻ sha256_init sys_mmap ↻ sha256_k sys_openat_rd sys_read sha256_update sha256_compress_ni_blocks blk_set_byte sha256_compress sha256_compress_ni blk_word blk_byte sys_close ↻ sha256_final blk_set_byte ↻ sha256_compress ↻ dp_hexenc di_publish di_has_cid sys_mmap ↻ di_cat di_contains di_strlen di_cat ↻ di_wdec sys_mmap ↻ gossip_digest di_eol di_tab gossip_select

structs

none

consts

none

functions

13func g_ck(name: *u8, cond: i64, st: *i64) -> i64 { st[1]=st[1]+1; if cond==1 { st[0]=st[0]+1; g_puts(" [OK] " as *u8) } else { g_puts(" [FAIL] " as *u8) } g_puts(name); g_puts("\n" as *u8); return 0 }
called by 1: main calls 1: g_puts
14func g_fix(path: *u8, content: *u8, n: i64) -> i64 { let fd: i64=sys_openat_wr(path, 0x1a4); if fd<0 { return 0-1 } sys_write(fd, content, n); sys_close(fd); return 0 }
16func main() -> i64