nx_commons_witness.nx
buildroot/runtime/nx_commons_witness.nx
about
nx_commons_witness.nx -- the PRODUCER of witnessed_permil, the term nx_commons_lib leans on hardest
and which, until now, NOTHING in the estate emitted.
★ A GUARD WHOSE INPUT THE PREVIOUS STEP DOES NOT EMIT IS A GUARD NOBODY CAN USE. nx_commons_lib
scores standing from third-party-attested giving, and the sybil ring collapses precisely because it
cannot manufacture witnesses. But no organ computed that number, so the whole rule was unusable in
practice -- a ruler with no way to take a reading.
KNOWN GOOD MATCHED: nx_trust_corroborate (the spore's sovereign trust bootstrap, 2026-06-05). Its
rule is exactly right and is adopted here verbatim in spirit:
- a claim is admitted only if >= K INDEPENDENT sources present the EXACT SAME bytes
- WE hash every source's view with our own sha256; a source's self-claimed hash is never trusted
- K=1 is HEARSAY and is forbidden by construction; K>=2 is corroboration
"A single tampered source cannot reach K alone" is the same anti-sybil property as the trust-flow
cap in nx_commons_lib, one layer further down.
TWO IMPROVEMENTS, each measured by nx_commons_witness_gate rather than asserted:
1. PLURALITY TARGET, NOT SOURCE-0 TARGET. The known good computes
let agree = tc_agreement_count(fps, fps, n_sources)
where the target fingerprint IS source 0's. So admission counts agreement WITH SOURCE 0, not with
the majority. If source 0 is poisoned and K-1 accomplices present the identical poison, the claim
is admitted while ANY NUMBER of honest sources presenting the true bytes are simply not consulted.
★★★★★★ AN AGREEMENT COUNT ANCHORED ON ONE PARTICULAR SOURCE IS NOT A MAJORITY, IT IS THAT
SOURCE'S OPINION WEARING A QUORUM'S CLOTHES.
Here the target is the largest agreement CLUSTER, so poison must out-number truth, not merely
occupy index 0.
2. PARTY EXCLUSION -- the thing a commons needs and a trust store does not. "The person I billed says
I helped them" is K=1 hearsay dressed as attestation, and it is exactly what the rent-extractor
has in abundance: every counterparty will confirm the fee-justifying service was rendered. Neither
the giver nor the receiver counts toward corroboration of their own exchange. A witness with a
stake is a participant.
Integer only, no floats. Thresholds named (law 11). license_tier: ORIGINAL
dependencies 2 imports · 1 importers
imports: nx_sha256.nxnx_syscalls.nx
imported by: nx_commons_witness_gate.nx
structs
| none |
consts
| 39 | const CWIT_HASHLEN: i64 = 32 |
| 40 | const CWIT_K_MIN: i64 = 2 // hearsay floor -- one voice is never corroboration |
| 41 | const CWIT_FULL: i64 = 5 // independent attestors for a full 1000-permil reading |
| 42 | const CWIT_SCALE: i64 = 1000 |
functions
| 44 | func cwit_hash_eq(a: *u8, b: *u8) -> i64 |
| 51 | func cwit_is_independent(attestor: i64, giver: i64, receiver: i64) -> i64 called by 1: cwit_plurality_agreement |
| 60 | func cwit_plurality_agreement(views: *u8, stride: i64, len: i64, called by 2: cwit_witnessed_permilmain calls 4: sys_mmapsha256_digestcwit_is_independentcwit_hash_eq |
| 92 | func cwit_permil(agreement: i64, k: i64) -> i64 called by 1: cwit_witnessed_permil |
| 102 | func cwit_witnessed_permil(views: *u8, stride: i64, len: i64, |
| 114 | func cwit_source0_agreement(views: *u8, stride: i64, len: i64, n: i64) -> i64 |