Skip to content

Commit 7fcf984

Browse files
mastercybclaude
andcommitted
fix: provable consensus — full tri-kernel, not just PageRank
Replace PageRank-only computation with complete tri-kernel: D (diffusion) + S (springs) + H (heat, 2-hop). 4 SpMV per iteration instead of 1. Total: 1.42B constraints (33% zheng capacity) instead of 624M (14.5%). Still feasible with 67% headroom. Circuit now shows all three operators explicitly. Edge values cached after first read. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4e0d1f0 commit 7fcf984

1 file changed

Lines changed: 81 additions & 50 deletions

File tree

root/cyber/research/provable consensus.md

Lines changed: 81 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,20 @@ date: 2026-03-23
99

1010
## the claim
1111

12-
[[foculus]] consensus — the stationary distribution π* of a stake-weighted [[random walk]] on the [[cybergraph]] — can be proven correct inside a [[zheng]] circuit. a single proof (~50 μs to verify) replaces all voting rounds, all message passing, all quorum checks. consensus becomes computation.
12+
[[foculus]] consensus — the fixed point of the [[tri-kernel]] composite operator over the [[cybergraph]] — can be proven correct inside a [[zheng]] circuit. a single proof (~50 μs to verify) replaces all voting rounds, all message passing, all quorum checks. consensus becomes computation.
13+
14+
the [[tri-kernel]] is three operators, not one. [[PageRank]] (diffusion) is only a third of the picture:
15+
16+
$$\phi^{(t+1)} = \text{norm}[\lambda_d \cdot \mathcal{D}(\phi^t) + \lambda_s \cdot \mathcal{S}(\phi^t) + \lambda_h \cdot \mathcal{H}_\tau(\phi^t)]$$
17+
18+
- $\mathcal{D}$ (diffusion) — where does probability flow? [[random walk]] on weighted adjacency
19+
- $\mathcal{S}$ (springs) — screened Laplacian: what satisfies structural constraints? mean neighbor [[focus]]
20+
- $\mathcal{H}_\tau$ (heat) — multi-scale smoothing: what does the graph look like at resolution τ? 2-hop context
21+
22+
the composite converges to a unique fixed point $\phi^*$ by the [[collective focus theorem]]. this $\phi^*$ is [[focus]] — the consensus ranking.
1323

1424
this is possible because of two ingredients:
15-
1. π* is deterministic given the graph — same adjacency → same π* → verifiable
25+
1. $\phi^*$ is deterministic given the graph — same adjacency → same $\phi^*$ → verifiable
1626
2. [[algebraic state commitments]] let the circuit read the graph as polynomial evaluations instead of hash paths — O(|E|) field ops instead of O(|E| × log n) [[Hemera]] hashes
1727

1828
without algebraic NMT, provable consensus is impossible in practice — hemera cost inside the circuit is prohibitive. with algebraic NMT, it fits within [[zheng]]'s capacity with room to spare.
@@ -34,48 +44,47 @@ no messages between validators. no leader. no quorum. no voting. no finality gad
3444

3545
## the computation
3646

37-
### PageRank iteration
47+
### tri-kernel iteration
3848

39-
π* is the fixed point of:
49+
$\phi^*$ is the fixed point of the composite [[tri-kernel]] operator. each iteration applies three sparse matrix operations and combines them:
4050

41-
$$\pi^{(t+1)} = \alpha M^\top \pi^{(t)} + \frac{1-\alpha}{|P|} \mathbf{1}$$
51+
```
52+
D_step: d[j] += α × w_ij × φ[i] / out_degree[i] # diffusion (PageRank)
53+
d[i] += (1-α) / |P| # teleport
4254
43-
where $M = D^{-1}A$ is the column-normalized transition matrix, $\alpha = 0.85$, and $A$ is the stake-weighted adjacency matrix of the [[cybergraph]].
55+
S_step: s[i] = Σ_j (A_ij + A_ji) × φ[j] / degree[i] # springs (mean neighbor)
4456
45-
each iteration is a sparse matrix-vector multiply (SpMV):
57+
H_step: h = A × (A × φ) # heat (2-hop)
58+
h[i] /= degree²[i] # normalize
4659
60+
combine: φ_new = normalize(λ_d × d + λ_s × s + λ_h × h)
4761
```
48-
for each edge (i → j) with weight w_ij:
49-
π_new[j] += α × w_ij × π[i] / out_degree[i]
50-
51-
for each particle i:
52-
π_new[i] += (1 - α) / |P| # teleport
5362

54-
normalize: π_new /= sum(π_new)
55-
```
63+
with default weights $\lambda_d = 0.5$, $\lambda_s = 0.3$, $\lambda_h = 0.2$.
5664

5765
### cost per iteration
5866

59-
| operation | count | constraints per op | total |
60-
|---|---|---|---|
61-
| edge multiplication | \|E\| = 2.7M | 1 (field mul) | 2.7M |
62-
| degree division | \|E\| | 1 (field mul by precomputed inverse) | 2.7M |
63-
| accumulation | \|P\| = 2.9M | 1 (field add) | 2.9M |
64-
| teleport | \|P\| | 1 (field add) | 2.9M |
65-
| normalization | \|P\| | 1 (field mul) | 2.9M |
66-
| total per iteration | | | ~13.2M |
67+
each operator is a sparse matrix-vector multiply (SpMV). heat requires TWO SpMV (A²φ = A(Aφ)).
68+
69+
| operator | SpMV count | edge ops | particle ops | constraints |
70+
|---|---|---|---|---|
71+
| D (diffusion) | 1 | \|E\| muls + divs | \|P\| adds (teleport) | ~8.3M |
72+
| S (springs) | 1 | \|E\| muls + divs (symmetric) | \|P\| divs | ~8.3M |
73+
| H (heat) | 2 |\|E\| muls + divs | \|P\| divs | ~16.6M |
74+
| combine | 0 | 0 |\|P\| muls + \|P\| adds + normalize | ~14.6M |
75+
| total per iteration | 4 SpMV | | | ~47.8M |
6776

6877
### convergence
6978

70-
from the [[spectral gap]] observation: [[bostrom]] converges in 23 iterations (measured contraction κ = 0.74, λ₂ = 0.13).
79+
from the [[spectral gap]] observation: [[bostrom]] converges in 23 iterations (measured contraction κ = 0.74, λ₂ = 0.13). the tri-kernel composite has contraction rate $\kappa = \max(\lambda_d \kappa_D, \lambda_s \kappa_S, \lambda_h \kappa_H)$ — the slowest operator determines convergence. empirically: 23 iterations suffice for all three operators simultaneously.
7180

72-
total constraints for π* computation: 23 × 13.2M304M
81+
total constraints for $\phi^*$ computation: 23 × 47.8M1.1B
7382

7483
### zheng capacity
7584

76-
[[zheng]] (SuperSpartan + WHIR) handles up to 2^32 ≈ 4.3 billion constraints. 304M / 4.3B = 7% of capacity. π* computation uses 7% of what zheng can prove.
85+
[[zheng]] (SuperSpartan + WHIR) handles up to 2^32 ≈ 4.3 billion constraints. 1.1B / 4.3B = 25.6% of capacity. the full tri-kernel uses a quarter of what zheng can prove.
7786

78-
remaining capacity: finalization checks (τ threshold), nullifier verification, state transition application — all fit in the remaining 93%.
87+
remaining capacity (74.4%): graph reads (algebraic NMT openings), finalization checks (τ threshold), nullifier verification, state transition application.
7988

8089
## the bottleneck: reading the graph
8190

@@ -105,15 +114,17 @@ each edge read = PCS evaluation = O(1) field operations.
105114
per edge: ~100 field operations ≈ 100 constraints
106115
2.7M edges: 2.7M × 100 = 270M constraints
107116
108-
plus π computation: 304M constraints
109-
plus finalization: ~50M constraints
117+
plus tri-kernel computation: 1,100M constraints
118+
plus finalization: 50M constraints
110119
111-
total: ~624M constraints
112-
zheng capacity: 4.3B constraints
113-
utilization: 14.5%
120+
total: 1,420M constraints
121+
zheng capacity: 4,300M constraints
122+
utilization: 33%
114123
```
115124

116-
feasible with 85% headroom. the algebraic representation transforms "read the graph" from a hash-intensive operation to an algebraic one. this is the enabling factor.
125+
feasible with 67% headroom. the algebraic representation transforms "read the graph" from a hash-intensive operation to an algebraic one. this is the enabling factor.
126+
127+
note: the tri-kernel requires reading edges THREE times per iteration (D reads once, S reads once, H reads twice via A²φ). with caching of edge values from the first read, subsequent reads are free (the circuit already has the values in witness). effective graph read cost: 270M for the first read, then reuse.
117128

118129
### the circuit
119130

@@ -122,61 +133,81 @@ PROVABLE_CONSENSUS_CIRCUIT:
122133
123134
inputs:
124135
BBG_commitment — polynomial commitment to graph state (32 bytes)
125-
π_claimed — claimed stationary distribution
126-
finality_set — particles claimed to be final (π_i > τ)
136+
φ_claimed — claimed tri-kernel fixed point (focus distribution)
137+
finality_set — particles claimed to be final (φ_i > τ)
127138
128139
witness:
129140
A_edges — all edge weights (opened from BBG_commitment)
130141
out_degrees — per-particle out-degree
131-
π_iterations — intermediate π vectors for each iteration
142+
sym_edges — symmetric adjacency (A + A^T) for springs
143+
φ_iterations — intermediate φ vectors for each iteration
132144
133145
constraints:
134146
135147
// SECTION 1: graph read (270M constraints)
136148
for each edge (i, j, w) in A_edges:
137149
assert PCS_eval(BBG_commitment, (axons_out, i, j)) == w
138150
// one polynomial evaluation check per edge
151+
// values cached in witness — reused by D, S, H without re-reading
139152
140-
// SECTION 2: degree consistency (2.9M constraints)
153+
// SECTION 2: degree + symmetry consistency (5.8M constraints)
141154
for each particle i:
142155
assert sum(w_ij for j in outgoing[i]) == out_degree[i]
156+
assert sym_degree[i] == in_degree[i] + out_degree[i]
143157
144-
// SECTION 3: π iteration (304M constraints)
158+
// SECTION 3: tri-kernel iteration (1,100M constraints)
145159
for t in 0..22:
160+
// D: diffusion (PageRank)
146161
for each edge (i → j, w):
147-
π_next[j] += α × w × π_t[i] / out_degree[i]
162+
d[j] += α × w × φ_t[i] / out_degree[i]
163+
for each particle i: d[i] += (1-α) / |P|
164+
165+
// S: springs (mean neighbor focus)
166+
for each edge (i, j, w_sym):
167+
s[i] += w_sym × φ_t[j] / sym_degree[i]
168+
169+
// H: heat (2-hop smoothed)
170+
// first pass: h_temp = A × φ_t
171+
for each edge (i → j, w):
172+
h_temp[j] += w × φ_t[i]
173+
// second pass: h = A × h_temp
174+
for each edge (i → j, w):
175+
h[j] += w × h_temp[i]
176+
for each particle i: h[i] /= degree²[i]
177+
178+
// combine: φ_{t+1} = normalize(λ_d·d + λ_s·s + λ_h·h)
148179
for each particle i:
149-
π_next[i] += (1 - α) / |P|
150-
π_next /= sum(π_next)
151-
assert π_iterations[t+1] == π_next
180+
φ_next[i] = λ_d × d[i] + λ_s × s[i] + λ_h × h[i]
181+
φ_next /= sum(φ_next)
182+
assert φ_iterations[t+1] == φ_next
152183
153184
// SECTION 4: convergence check (2.9M constraints)
154-
assert ||π_iterations[22] - π_iterations[21]||_1 < ε
185+
assert ||φ_iterations[22] - φ_iterations[21]||_1 < ε
155186
156187
// SECTION 5: finality check (|F| × 3 constraints)
157188
for each particle i in finality_set:
158-
assert π_claimed[i] > τ(t)
189+
assert φ_claimed[i] > τ(t)
159190
assert i has valid nullifiers (not in spent set)
160191
161192
// SECTION 6: output binding
162-
assert π_claimed == π_iterations[22]
193+
assert φ_claimed == φ_iterations[22]
163194
164-
total: ~624M constraints
195+
total: ~1,420M constraints (33% of zheng capacity)
165196
```
166197

167198
### proof generation
168199

169-
prover time: 624M constraints at ~1 μs per constraint (zheng prover on modern hardware) ≈ 624 seconds ≈ ~10 minutes.
200+
prover time: 1.42B constraints at ~1 μs per constraint (zheng prover on modern hardware) ≈ 1,420 seconds ≈ ~24 minutes.
170201

171-
this is per-epoch, not per-block. one proof covers the full π* computation for the entire graph state. blocks within the epoch inherit the proven π*.
202+
this is per-epoch, not per-block. one proof covers the full tri-kernel computation for the entire graph state. blocks within the epoch inherit the proven φ*.
172203

173-
with GPU acceleration (SuperSpartan is embarrassingly parallel): ~60 seconds. practical for epoch boundaries.
204+
with GPU acceleration (SuperSpartan's SpMV is embarrassingly parallel): ~2-3 minutes. practical for epoch boundaries (e.g. every 100 blocks ≈ 500 seconds).
174205

175206
### proof verification
176207

177-
verifier time: O(log N) = O(log 624M) ≈ 30 Hemera hashes + field ops ≈ 50 μs.
208+
verifier time: O(log N) = O(log 1.42B) ≈ 31 Hemera hashes + field ops ≈ 50 μs.
178209

179-
one number: 50 μs to verify that 2.9 million particles have the correct consensus ranking. on a phone. without downloading the graph.
210+
one number: 50 μs to verify that the complete tri-kernel (diffusion + springs + heat) over 2.9 million particles converged to the correct φ*. on a phone. without downloading the graph.
180211

181212
## what this replaces
182213

0 commit comments

Comments
 (0)