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)

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

main nx_robust_hll_alloc nx_hll_alloc write_i64_le nx_robust_hll_add nx_hll_add murmur3_32 mm_load_u32_le mm_rotl32 nx_clz32 nx_bits_clz32 nx_robust_hll_estimate nx_hll_estimate nx_hll_pow2_neg_q32 nx_hll_alpha_m_sq_q64 nx_hll_bias_table_n nx_hll_bias_table_get nx_hll_bias_lgk4 nx_hll_bias_lgk5 nx_hll_bias_lgk6 nx_hll_bias_lgk7 nx_hll_bias_lgk8 nx_hll_bias_lgk9 nx_hll_bias_lgk10 nx_hll_log2_ppm nx_hll_bias_correct nx_hll_bias_table_n ↻ nx_hll_bias_table_get ↻ nx_mulshl_div_i64 nx_i128_alloc nx_i128_mul_i64 nx_i128_mul_u64 nx_i128_neg nx_i128_shl nx_i128_div_i64 nx_i128_is_neg nx_i128_neg ↻ nx_i128_udiv_u64 nx_median_i64 nx_robust_hll_poison_inner

structs

none

consts

none

functions

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