code wiki / _hdl_build / nx_netsync_gate.nx
nx_netsync_gate.nx
buildroot/runtime/_hdl_build/nx_netsync_gate.nx
about
nx_netsync_gate.nx -- CERTIFICATION of nx_netsync (gamebench gap-queue rank 1: networking-multiplayer).
The existing nx_lockstep/nx_rollback gates prove netcode mechanisms on a TOY stepper; this gate proves
the same laws hold when the simulation is the REAL certified world (nx_worldsim) and the snapshots are
REAL save files (nx_gamesave) -- the composition the capability actually demands.
T1 LOCKSTEP DETERMINISM -- two peers, same commands, different within-tick arrival order,
200 ticks -> checksums equal EVERY tick and shared state word-exact
T2 STALL-NOT-GUESS -- missing one peer's input for a tick freezes the session (no advance, no state
change) until it arrives; advancing on partial input is THE lockstep desync bug
T3 ARRIVAL-CHAOS IMMUNE -- the full 400-command schedule delivered in a shuffled order with
duplicates -> final state EXACTLY equals the in-order run; a conflicting resend is REFUSED
T4 DESYNC LOCALIZED -- a 1-unit wealth mint injected into one peer at tick 120 is first visible in
the checksum stream AT tick 120 (never earlier, never missed)
T5 ROLLBACK ON THE REAL SIM -- speculative head with predicted inputs diverges when the prediction
was wrong; discard + resim from the confirmed state converges bit-exact to ground truth; a
CORRECT prediction triggers no divergence (no false rollback)
T6 LATE-JOIN VIA nx_gamesave -- a peer that loads a mid-session snapshot file into a ZEROED arena
tracks the original checksum-for-checksum to the end (GX-9 transparency)
T7 BOUNDED + LOUD -- out-of-range tick/peer and conflicting input each refuse with a DISTINCT code
and change nothing
T8 ANTI-VACUITY -- the session actually traded and grew (a frozen or all-no-op world would pass
T1-T3 while proving nothing)
T9 ARTIFACT -- the final session round-trips through a real save file and RESUMES identically;
knowledge/nx_netsync_session.sav is the board evidence
license_tier: ORIGINAL expect_exit: 0
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_netsync.nxnx_gamesave.nxnx_net_chan.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 29 | const K_MAGIC_25214903917: i64 = 25214903917 |
| 30 | const K_MAGIC_2654435761: i64 = 2654435761 |
| 31 | const K_MAGIC_100000000: i64 = 100000000 |
| 32 | const K_MAGIC_1000000: i64 = 1000000 |
| 33 | const K_MAGIC_4242: i64 = 4242 |
| 34 | const K_MAGIC_20260730: i64 = 20260730 |
| 35 | const K_MAGIC_60621: i64 = 60621 |
| 36 | const K_MAGIC_1785425000: i64 = 1785425000 |
| 37 | const K_MAGIC_9750: i64 = 9750 |
| 38 | const K_MAGIC_60620: i64 = 60620 |
| 39 | const K_MAGIC_38921: i64 = 38921 |
| 40 | const K_MAGIC_31337: i64 = 31337 |
| 67 | const GMAXT: i64 = 300 |
| 68 | const GNFAC: i64 = 6 |
functions
| 42 | func pw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 43 | func pn(v: i64) -> i64 |
| 52 | func lcg(s: *i64) -> i64 { s[0] = ((s[0]*K_MAGIC_25214903917)+11) & 0x7FFFFFFFFFFF; return s[0] } called by 1: main |
| 56 | func cmd_for(t: i64, p: i64) -> i64 called by 1: main |
| 70 | func mksess(a: *i64, self_id: i64, seed: i64) -> i64 |
| 83 | func main() -> i64 |