code wiki / (root) / sketch_robust_hll_test.nx

sketch_robust_hll_test.nx

buildroot/runtime/sketch_robust_hll_test.nx

3281 B95 linesdepth 7pulls 12 transitivereach 0 importersview sourcekind gate/prooftopic sketch
docsdependenciesstructsconstsfunctions

about

sketch_robust_hll_test.nx -- adversarial-safety smoke for the median-of-k HLL wrapper. Two cases: 1. Honest input: stream N distinct keys, verify median estimate within +-15% of N (same tolerance as basic HLL). Verifies the wrapper doesn't regress accuracy. 2. Adversarial input: stream the same N keys, then explicitly saturate one inner sketch's registers (simulates an attacker who found a hash collision against that seed). Verify the median estimate STILL within 25% of N -- one poisoned sketch out of 5 doesn't move the median. 3. Typed envelope: query returns adv_safety = NX_ADV_ADVERSARIAL (distinguishes from basic HLL which is Honest).

dependencies 3 imports · 0 importers

syscalls.nx sketch_robust_hll.nx sketch_types.nx sketch_robust_hll_test.nx

imports: syscalls.nxsketch_robust_hll.nxsketch_types.nx

imported by: nobody (leaf or entry point)

structs

none

consts

none

functions

20func write_i64_le(buf: *u8, value: i64) -> i64 {
31func iabs(x: i64) -> i64 {
36func main() -> i64 {