secp256k1 Point-Addition Challenge with Lumbda Attack

JSON

rev 10  |  russell  |  1781220210613  |  JSON

rev 9
rev 10
211shot-averaging noise washes out:211shot-averaging noise washes out:
212212
n213DIALOG_GCD + m=154 + cmp=4 + HMR + borrowed-everywhere (sweep-017c)n213DIALOG_GCD + m=154 + cmp=4 + HMR + borrowed-everywhere +
214CAS-borrowed-from-red-tmp + pseudo-Mersenne mod-double (sweep-030)
214versus HEAD:215versus HEAD:
215216
n216- **peak qubits:** **4,886** (us) · 1,355 (HEAD)n217- **peak qubits:** **4,886** (us) · 1,309 (HEAD)
217- **avg Toffoli:** **23,563,264** (us) · 1,773,011 (HEAD)218- **avg Toffoli:** **16,197,312** (us) · 1,503,355 (HEAD)
218- **n_ops:** **108,384,032** (us) · 12,788,119 (HEAD)
219- **score (avg Toffoli × qubits):** **1.1513e+11** (us) · 2.402e+09 (HEAD)219- **score (avg Toffoli × qubits):** **7.9140e+10** (us) · 1.968e+09 (HEAD)
220- **Δ vs HEAD:** **+4,694 %**220- **Δ vs HEAD:** **+3,921 %** (gap 40.21×)
221 
222HEAD reference: ``jackylee0424`` submission ``a66b042`` (live target since
2232026-06-08; prior baseline ``2.402e+09`` retired after upstream scan
224caught HEAD's promoted frontier at ``1.968e+09``).
221225
222Production-width emit lands via lumbda C tier on 3090-ai bare-metal,226Production-width emit lands via lumbda C tier on 3090-ai bare-metal,
242246
243Truncated comparator finding — HEAD's ``*dgcd-compare-bits*`` knob247Truncated comparator finding — HEAD's ``*dgcd-compare-bits*`` knob
n244(56 bits at n=256 in HEAD-prod, ~22 % of width) carries massiven248(56 bits at n=256 in HEAD-prod, ~22 % of width) carries real
245headroom. Our cmp=2 (~0.8 % of width at n+1=257) still passes249headroom. cmp=4 (~1.6 % of width at n+1=257) lands as our
246``byte-identity-cpu-gpu true`` at bend dispatch — Kaliski's250production minimum after classical-sim probe-width verification.
247invariant keeps u/v close enough in magnitude that top-2-bit251 
248disambiguation suffices for ``l-gt``. cmp lever bottomed out at252cmp=2 caught as algorithmically broken — bend dispatch reports
249cmp=2; lambda path closed.253``byte-identity-cpu-gpu true`` & status PASS, but classical-sim
254verify at n+1∈{18, 32} reveals ``out=0`` plus leaked ancilla.
255Bend only validates CPU & GPU simulator agreement on a wrong
256circuit, not algorithmic correctness vs. expected mod-inverse.
257Same defect class re-emerges below at ``DIALOG_GCD_ACTIVE_ITERATIONS``.
258 
259DIALOG_GCD active-iters cap — non-monotonic correctness. Setting
260iters below textbook ``2n`` produces wrong mod-inverse output at
261specific iter values, sporadically. K-correction (classical-replay
262backward sweep using K = classical-mod-inv(p, r_on_1)) depends on
263``r_on_1`` arithmetic that breaks at certain iters. ``dgcd-resolve-iters``
264gates ``r_on_1 != 0``, which is necessary not sufficient.
265 
266Probe data:
267 
268- n+1=18 (textbook 34): iters ∈ {15: OK, 16: WRONG, 17: WRONG, 18: OK, 25, 26, 2
 >7: OK}
269- n+1=32 (textbook 62): iters ∈ {10, 12: OK, 15: WRONG, 16, 24, 28, 32, 48, 49, 
 >50: OK}
270 
271HEAD ships ``iters=399`` at n=256 (textbook × 0.776) — a tuned
272value that survives upstream's test suite. We adopt ``iters=399``
273as our production safe value & retract earlier iters-cap
274exploration that relied solely on bend PASS without classical-sim
275verification.
250276
251HOST_GATED measurement-clear port — HEAD's ``mod.rs:24788-24791``277HOST_GATED measurement-clear port — HEAD's ``mod.rs:24788-24791``
263substitution produces correct mod-inverse output matching control289substitution produces correct mod-inverse output matching control
264(non-HMR) baseline.290(non-HMR) baseline.
nn291 
292Pseudo-Mersenne mod-double — Schrottenloher 2026/1128 Algorithm 7
293port (sweep-030). Reference implementation: Qarton, gitlab.inria.fr/
294capsule/qubits-projects/ec-point-addition. Paper open at arXiv
2952606.02235. secp256k1's prime takes pseudo-Mersenne form
296``p = 2²⁵⁶ − 2³² − 977``, so our off-Mersenne residue
297``f = 2³² + 977 = 4294968273`` fits in 33 bits. Control
298``mod-double-inplace!`` emits an ``add-const`` at full ``n+1`` width
299followed by a ``csub-const`` at full ``n+1`` width — 4n Toffoli per
300call. New ``mod-double-inplace-pseudo-mersenne!`` emits a single
301``cadd-const`` at width ``lsbs = padding + bit-length(f) = 30 + 33 =
30263``, controlled on our MSB slot of a pre-double value — 2(lsbs − 1) =
303124 Toffoli per call. Per-call saving at production width:
30487.9 %. Full-stack production result: avg Toffoli **21,917,696 →
30516,197,312** (−26.1 %). Peak qubits 4,886 unchanged — algorithm
306reuses existing scratch (carry-in slot, parity flag), allocates
307zero new ancilla.
308 
309Probe-width verification (classical-sim, ``verify-pseudo-mersenne-double.lsp``):
310 
311- **n+1=5, p=13:** Toffoli 16 → 4 (−75.0 %), exhaustive 13 inputs;
312  pmersenne matches expected output on 11 / 13, misses on a
313  measured 2-input strip predicted by paper's non-exact zone
314  (size ≈ f).
315- **n+1=9, p=251:** Toffoli 32 → 12 (−62.5 %), exhaustive 251
316  inputs; matches on 247 / 251, misses on a 4-input strip
317  (predicted 5).
318- **n+1=18, p=131,071 (Mersenne):** Toffoli 68 → 30 (−55.9 %),
319  1000 random inputs match 1000 / 1000. Mersenne case has
320  ``f = 1`` so our non-exact strip shrinks to ``{p − 1}``.
321- **n+1=32, p=2³¹ − 1 (Mersenne):** Toffoli 124 → 58 (−53.2 %),
322  1000 random inputs match 1000 / 1000.
323 
324Non-exact zone scales as ``f / p``; at secp256k1's ``f / p ≈
3252³³ / 2²⁵⁶ ≈ 2⁻²²³``, mispredict probability sits below any
3269024-shot harness can ever sample. Bend dispatch on 3090-ai:8320
327returns ``byte-identity-cpu-gpu true``, status PASS.
265328
266Borrowed-carries finding — Cuccaro adder's HMR-uncompute variant329Borrowed-carries finding — Cuccaro adder's HMR-uncompute variant
302Two axes of remaining gap, both substrate-bound:365Two axes of remaining gap, both substrate-bound:
303366
n304- **Peak qubits: 4,886 vs 1,355 = 3.6× behind.** Margin-axisn367- **Peak qubits: 4,886 vs 1,309 = 3.73× behind.** Margin-axis
305  full-saturation closes the bulk of our prior peak gap. Remaining368  full-saturation closes the bulk of our prior peak gap. Remaining
306  ancilla pool slot use comes from per-call mask alloc patterns &369  ancilla pool slot use comes from per-call mask alloc patterns &
308  log. Further savings need substrate change to m-hist register371  log. Further savings need substrate change to m-hist register
309  allocation.372  allocation.
n310- **avg Toffoli: 23.56 M vs 1.77 M = 13.3× behind.** Sweep-017'sn373- **avg Toffoli: 16.20 M vs 1.50 M = 10.78× behind.** Sweep-017's
311  borrowed-carries ladder shaved 1.6 M Toffoli at production width374  borrowed-carries ladder + sweep-030's pseudo-Mersenne mod-double
375  shaved roughly 7.4 M Toffoli at production width without touching
312  without touching peak qubits. Two HEAD primitives remain unported:376  peak qubits. Two HEAD primitives remain unported:
313  ``cuccaro_add_fast_windowed_low_to_ext`` at ``mod.rs:25149`` (lets377  ``cuccaro_add_fast_windowed_low_to_ext`` at ``mod.rs:25149`` (lets
314  APPLY_WINDOW_BLOCKS actually fire under our substrate) & remaining378  APPLY_WINDOW_BLOCKS actually fire under our substrate) & remaining
315  HMR + CZ_if substitution opportunities beyond our ``ctrl-cuccaro-*-hosted!``379  HMR + CZ_if substitution opportunities beyond our ``ctrl-cuccaro-*-hosted!``
n316  uncompute (sweep-012) & cuccaro-fast / cmp-lt-into-fast call sitesn380  uncompute (sweep-012), cuccaro-fast / cmp-lt-into-fast call sites
317  (sweep-017b–d). Toffoli gap dominates our score gap entirely —381  (sweep-017b–d), & CAS-borrowed HMR through schoolbook controlled-
318  every future sweep targets Toffoli reduction.382  add-subtract (sweep-022b). Pseudo-Mersenne mod-halve (inverse of
383  Algorithm 7) stays open as a paired-port target. Toffoli gap
384  dominates our score gap entirely — every future sweep targets
385  Toffoli reduction.
319386
320The MARGIN / SLOPE / comparator-truncation knob axis has bottomed387The MARGIN / SLOPE / comparator-truncation knob axis has bottomed
414landing point — Toffoli (avg/shot) · peak qubits · score:481landing point — Toffoli (avg/shot) · peak qubits · score:
415482
n416- **HEAD production:** 1,773,011 Toffoli @ 1,355 qubits → 2.402e+09n483- **HEAD production (jackylee0424 a66b042, 2026-06-08):** 1,503,355
484  Toffoli @ 1,309 qubits → 1.968e+09
417- **Google low-gate:** 2,100,000 Toffoli @ 1,425 qubits → 3.0e+09485- **Google low-gate:** 2,100,000 Toffoli @ 1,425 qubits → 3.0e+09
418- **Google low-qubit:** 2,700,000 Toffoli @ 1,175 qubits → 3.2e+09486- **Google low-qubit:** 2,700,000 Toffoli @ 1,175 qubits → 3.2e+09
419- **Textbook initial:** 3,942,753 Toffoli @ 2,715 qubits → 1.07e+10487- **Textbook initial:** 3,942,753 Toffoli @ 2,715 qubits → 1.07e+10
420- **DIALOG_GCD + borrowed-everywhere (sweep-017c):** 23,563,264 Toffoli @ 4,886 488- **DIALOG_GCD + borrowed-everywhere (sweep-017c):** 23,563,264 Toffoli @ 4,886 
>qubits → 1.1513e+11>qubits → 1.1513e+11
nn489- **+ pseudo-Mersenne mod-double (sweep-030):** 16,197,312 Toffoli @ 4,886 qubit
 >s → **7.9140e+10**
421490
422Google's two private points each sit under **1,500 peak qubits** —491Google's two private points each sit under **1,500 peak qubits** —
4231,175 & 1,425 respectively. HEAD production already passes both4921,175 & 1,425 respectively. HEAD production already passes both
n424(1,355 qubits / 2.402e+09 score) — a public submission beat Google'sn493(1,309 qubits / 1.968e+09 score) — a public submission beat Google's
425private frontier before our entry landed. Our active race runs494private frontier before our entry landed. Our active race runs
426HEAD-vs-us; Google's points sit as a historical landmark, not a live495HEAD-vs-us; Google's points sit as a historical landmark, not a live
427target.496target.
428497
n429Our peak qubits (**4,886**) sit 3.4× over Google's low-qubit pointn498Our peak qubits (**4,886**) sit 4.2× over Google's low-qubit point
430& 3.6× over HEAD. Peak-qubit headroom forms one axis of remaining499& 3.73× over HEAD. Peak-qubit headroom forms one axis of remaining
431gap; Toffoli count (23.56 M vs HEAD's 1.77 M) forms the other.500gap; Toffoli count (16.20 M vs HEAD's 1.50 M) forms a second axis.
432See `What HEAD Still Owns`_ above.501See `What HEAD Still Owns`_ above.
433502
n434Sweep ladder under our borrowed-carries lane (peak qubits held atn503Sweep ladder under our borrowed-carries + pseudo-Mersenne lane,
504gap recomputed against live HEAD ``1.968e+09`` (peak qubits held
4354,886 throughout — gap closure ran entirely through Toffoli):505at 4,886 throughout — gap closure ran entirely through Toffoli):
436506
n437- **sweep-014 (m=154 saturation):** score 1.230e+11 — gap 51.2× vs HEADn507- **sweep-014 (m=154 saturation):** score 1.230e+11 — gap 62.5× vs HEAD
438- **sweep-017b (cuccaro-fast borrowed):** score 1.186e+11 — gap 49.4×508- **sweep-017b (cuccaro-fast borrowed):** score 1.186e+11 — gap 60.3×
439- **sweep-017c (mod-arith borrowed):** score 1.1513e+11 — gap 47.9×509- **sweep-017c (mod-arith borrowed):** score 1.1513e+11 — gap 58.5×
510- **sweep-017e (m=154/cmp=4 full-stack borrowed):** score 1.1159e+11 — gap 56.7×
511- **sweep-022b (CAS-borrowed HMR via red-tmp):** score 1.0709e+11 — gap 54.42×
512- **sweep-030 (pseudo-Mersenne mod-double):** score **7.9140e+10** — gap **40.21
 >×**
513 
514Session total since sweep-003 baseline (``4.368e+13``, our entry
515score): **552× score reduction shipped**, gap closed from
516``22,195×`` behind HEAD's promoted frontier (``+2,219,400 %``)
517down to **40.21× behind** (``+3,921 %``).
440518
441Our lumbda-tier validation gates each variant against byte-identical519Our lumbda-tier validation gates each variant against byte-identical
467- `lumbda.com/bend <https://lumbda.com/bend.html>`__ — bend primitive545- `lumbda.com/bend <https://lumbda.com/bend.html>`__ — bend primitive
468  catalog; wire protocol; CUDA form list.546  catalog; wire protocol; CUDA form list.
t469 t
rev 9  |  russell  |  1780942596926  |  JSON

rev 8
rev 9
120picks our winner without spending production-scale budget.120picks our winner without spending production-scale budget.
121121
n122Σ Toffoli per variant per width (sigma Toffoli, sum of Toffoli ops):n122Σ Toffoli per variant (sigma Toffoli, sum of Toffoli ops) at
123p=5 · p=11 · p=251 widths:
123124
n124========================  =======  =======  ========n
125variant                   p=5      p=11     p=251
126========================  =======  =======  ========
127v-fermat-schoolbook       9 054    21 336    167 984125- **v-fermat-schoolbook:** 9,054 · 21,336 · 167,984
128v-fermat-solinas          7 182    16 056     84 208126- **v-fermat-solinas:** 7,182 · 16,056 · 84,208
129v-by-text-schoolbook      5 982    12 376     45 104127- **v-by-text-schoolbook:** 5,982 · 12,376 · 45,104
130v-by-text-solinas         5 646    11 704     40 176128- **v-by-text-solinas:** 5,646 · 11,704 · 40,176
131v-by-ref-schoolbook       3 482     8 104     29 104129- **v-by-ref-schoolbook:** 3,482 · 8,104 · 29,104
132v-by-ref-solinas          3 146     7 432     24 176130- **v-by-ref-solinas:** 3,146 · 7,432 · 24,176
133========================  =======  =======  ========
134131
135Knob attribution at p=251:132Knob attribution at p=251:
169Per-architecture GPU wall (p=251, 1,024 shots):166Per-architecture GPU wall (p=251, 1,024 shots):
170167
n171========================  =========  =========  =========n168Wall time per variant on each GPU architecture:
172variant                   3090 ms    4090 ms    P40 ms169 
173========================  =========  =========  =========170- **v-fermat-schoolbook:** 290.1 ms (3090) · 149.2 ms (4090) · 531.7 ms (P40)
174v-fermat-schoolbook       290.1      149.2      531.7171- **v-by-ref-solinas:** 26.5 ms (3090) · 22.0 ms (4090) · 64.0 ms (P40)
175v-by-ref-solinas          26.5       22.0       64.0
176========================  =========  =========  =========
177172
178- 4090 (sm_89) runs 1.94× faster than 3090 on heaviest circuit, shrinking173- 4090 (sm_89) runs 1.94× faster than 3090 on heaviest circuit, shrinking
216shot-averaging noise washes out:211shot-averaging noise washes out:
217212
n218============================== ============================ =============n213DIALOG_GCD + m=154 + cmp=4 + HMR + borrowed-everywhere (sweep-017c)
219metric                         **DIALOG_GCD + m=154 + cmp=4 + HMR + borrowed-eve214versus HEAD:
>rywhere** HEAD 
220============================== ============================ =============215 
221peak qubits                    **4,886**                     1,355216- **peak qubits:** **4,886** (us) · 1,355 (HEAD)
222avg Toffoli                    **23,563,264**                1,773,011217- **avg Toffoli:** **23,563,264** (us) · 1,773,011 (HEAD)
223n_ops                          **108,384,032**               12,788,119218- **n_ops:** **108,384,032** (us) · 12,788,119 (HEAD)
224score (avg_tof × qubits)       **1.1513e+11**                2.402e+09219- **score (avg Toffoli × qubits):** **1.1513e+11** (us) · 2.402e+09 (HEAD)
225Δ vs HEAD                      **+4,694 %**                  —220- **Δ vs HEAD:** **+4,694 %**
226============================== ============================ =============
227221
228Production-width emit lands via lumbda C tier on 3090-ai bare-metal,222Production-width emit lands via lumbda C tier on 3090-ai bare-metal,
417-------------------------------411-------------------------------
418412
n419Upstream README reports two Google private Pareto points sitting below an413Full frontier as upstream README reports it (2026-06), plus our
420public published front:414landing point — Toffoli (avg/shot) · peak qubits · score:
421415
n422================================  =======================  ============  =======n416- **HEAD production:** 1,773,011 Toffoli @ 1,355 qubits → 2.402e+09
>=== 
423variant                           Toffoli (avg / shot)     Peak qubits   Score417- **Google low-gate:** 2,100,000 Toffoli @ 1,425 qubits → 3.0e+09
424================================  =======================  ============  =======418- **Google low-qubit:** 2,700,000 Toffoli @ 1,175 qubits → 3.2e+09
>=== 
425**HEAD production**               1,773,011                1,355         2.402e+419- **Textbook initial:** 3,942,753 Toffoli @ 2,715 qubits → 1.07e+10
>09 
426DIALOG_GCD + borrowed-everywhere  23,563,264               4,886         1.1513e420- **DIALOG_GCD + borrowed-everywhere (sweep-017c):** 23,563,264 Toffoli @ 4,886 
>+11>qubits → 1.1513e+11
427================================  =======================  ============  =======421 
>=== 
422Google's two private points each sit under **1,500 peak qubits** —
4231,175 & 1,425 respectively. HEAD production already passes both
424(1,355 qubits / 2.402e+09 score) — a public submission beat Google's
425private frontier before our entry landed. Our active race runs
426HEAD-vs-us; Google's points sit as a historical landmark, not a live
427target.
428 
429Our peak qubits (**4,886**) sit 3.4× over Google's low-qubit point
430& 3.6× over HEAD. Peak-qubit headroom forms one axis of remaining
431gap; Toffoli count (23.56 M vs HEAD's 1.77 M) forms the other.
432See `What HEAD Still Owns`_ above.
428433
429Sweep ladder under our borrowed-carries lane (peak qubits held at434Sweep ladder under our borrowed-carries lane (peak qubits held at
4304,886 throughout — gap closure ran entirely through Toffoli):4354,886 throughout — gap closure ran entirely through Toffoli):
431436
n432==========================  ============  ===========n437- **sweep-014 (m=154 saturation):** score 1.230e+11 — gap 51.2× vs HEAD
433sweep                       score         gap vs HEAD438- **sweep-017b (cuccaro-fast borrowed):** score 1.186e+11 — gap 49.4×
434==========================  ============  ===========439- **sweep-017c (mod-arith borrowed):** score 1.1513e+11 — gap 47.9×
435sweep-014 (m=154)           1.230e+11     51.2×
436sweep-017b (cuccaro-fast)   1.186e+11     49.4×
437sweep-017c (mod-arith)      1.1513e+11    47.9×
438==========================  ============  ===========
439440
440Our lumbda-tier validation gates each variant against byte-identical441Our lumbda-tier validation gates each variant against byte-identical
466- `lumbda.com/bend <https://lumbda.com/bend.html>`__ — bend primitive467- `lumbda.com/bend <https://lumbda.com/bend.html>`__ — bend primitive
467  catalog; wire protocol; CUDA form list.468  catalog; wire protocol; CUDA form list.
tt469 
rev 8  |  russell  |  1780924939372  |  JSON

rev 7
rev 8
81  EC add.81  EC add.
8282
n83Cross-tier validation runs on Python tier. C-tier & asm-tier escalationn83Cross-tier validation runs on Python tier locally. C-tier emits run
84routes through a QEMU guest (``ecdsa/vm-runner.sh``) — host policy locked84on 3090-ai bare-metal — 24 cores, 62 GB RAM, no virtualization tax.
85after three prior neoblanka crashes cemented per-tier escalation rules.85Heavy emit left neoblanka after three prior crashes cemented per-tier
86See lumbda's CLAUDE shard on asm memory discipline.86escalation rules. See lumbda's CLAUDE shard on asm memory discipline.
8787
88----88----
210-------------------------210-------------------------
211211
n212Full secp256k1 width (n+1=257, p = 2²⁵⁶ − 2³² − 977), 141 batches × 64n212Full secp256k1 width (n+1=257, p = 2²⁵⁶ − 2³² − 977), bend dispatch on
213shots = 9,024 shots, ``--rng-mode shake``, bend dispatch on 3090-ai:8320,
214``byte-identity-cpu-gpu true``, status PASS:2133090-ai:8320, ``byte-identity-cpu-gpu true``, status PASS. Static
214circuit Toffoli count (Σ CCX from QECCOPS1 binary parser) reproduces
215bend-dispatched avg Toffoli byte-for-byte at every variant landed —
216shot-averaging noise washes out:
215217
216============================== ============================ =============218============================== ============================ =============
n217metric                         **DIALOG_GCD + pool (current)** HEADn219metric                         **DIALOG_GCD + m=154 + cmp=4 + HMR + borrowed-eve
 >rywhere** HEAD
218============================== ============================ =============220============================== ============================ =============
n219peak qubits                    **37,268**                    1,355n221peak qubits                    **4,886**                     1,355
220avg Toffoli                    **24,189,512**                1,773,011222avg Toffoli                    **23,563,264**                1,773,011
221n_ops                          **89,582,248**                12,788,119223n_ops                          **108,384,032**               12,788,119
222Σ Toffoli (9024)               **218,286,156,288**           —
223score (avg_tof × qubits)       **9.015e+11**                 2.402e+09224score (avg_tof × qubits)       **1.1513e+11**                2.402e+09
224Δ vs HEAD                      **+37,424 %**                 —225Δ vs HEAD                      **+4,694 %**                  
225============================== ============================ =============226============================== ============================ =============
226227
n227Production-width emit lands via lumbda C tier in **7.7 minutes wall**,n228Production-width emit lands via lumbda C tier on 3090-ai bare-metal,
228322 MB peak RSS, 4.7 GB binary. File-port streaming writes 56-byte op229~322 MB peak RSS, ~5.2 GB binary. File-port streaming writes 56-byte
229records straight to disk via ``fwrite`` without an intermediate string230op records straight to disk via ``fwrite`` without an intermediate
230buffer.231string buffer.
232 
233Bend dispatch on 3090-ai:8320 validates ``byte-identity-cpu-gpu true``
234on every variant landed — CUDA simulator gate-by-gate agrees with
235CPU reference. Single ``demo_ops`` binary built locally on host via
236``cuda/Makefile`` with sm_86.
237 
238Width-envelope full-saturation finding — at production width
239(n+1=257) the release step ``(margin-1)×1000/slope`` reaches the
240textbook ``2n=512`` iter count only at ``m=154/s=300``. Below that
241margin, partial saturation leaves the ancilla pool with multiple
242width buckets, each ratcheting its own ``max(qubit_id)``. At
243``m=154`` every Kaliski iter operates at the same maximum width,
244ancilla pool sees ONE width bucket, & peak qubits hit the
245structural minimum at 4,886 — down from 16,370 at m=38 (−70 %).
246Score collapses 3.990e+11 → 1.230e+11 (−69 %) in a single
247margin-axis re-bracket.
248 
249Truncated comparator finding — HEAD's ``*dgcd-compare-bits*`` knob
250(56 bits at n=256 in HEAD-prod, ~22 % of width) carries massive
251headroom. Our cmp=2 (~0.8 % of width at n+1=257) still passes
252``byte-identity-cpu-gpu true`` at bend dispatch — Kaliski's
253invariant keeps u/v close enough in magnitude that top-2-bit
254disambiguation suffices for ``l-gt``. cmp lever bottomed out at
255cmp=2; lambda path closed.
256 
257HOST_GATED measurement-clear port — HEAD's ``mod.rs:24788-24791``
258pattern (Hadamard + Measure + Reset, classical-feedback CZ)
259substitutes our ccx-mask uncompute pass. Per-call save: (n+1)
260Toffoli replaced by 2(n+1) Cliffords (1 HMR + 1 CZ per bit).
261At n+1=257 production: 833,172 Toffoli saved (matches rng_ops
262exactly — one HMR-RNG per replaced CCX). Net score 4.126e+11 →
2633.990e+11 (−3.31 %).
264 
265QECCOPS1 wire format always supported HMR (kind 12), CZ (kind 9),
266push-cond (kind 15), pop-cond (kind 16); our lumbda emit pipeline
267gap was at ``gates.lsp`` — added Tier-1 + Tier-2 emit primitives.
268Classical-sim verification at three probe widths confirms HMR
269substitution produces correct mod-inverse output matching control
270(non-HMR) baseline.
271 
272Borrowed-carries finding — Cuccaro adder's HMR-uncompute variant
273(HEAD ``mod.rs:1097-1144``, ``cuccaro_add_fast``) replaces n CCX
274carry-uncompute ops per add with n HMR + n classical-conditioned CZ.
275Algorithmic saving: ~n Toffoli per add. Where a caller stages our
276scratch ``carries`` register changes everything:
277 
278- **Per-call allocation (sweep-016, rolled back):** classical-sim
279  verify PASSes at four probe widths. Production-width peak qubits
280  explode. Each call's fresh ``carries`` opens a new ancilla bucket
281  our pool never recycles.
282- **Shared host-allocation (sweep-016b):** alloc once at host scope,
283  reuse across Kaliski iters. Peak qubits stabilize, net score lands
284  +1.4 % WORSE — long-lived shared register competes with downstream
285  ancilla pool reuse patterns.
286- **Borrowed-from-caller (sweep-017b, lands):** caller passes its
287  own scratch region as ``carries-reg`` + ``carries-offset``.
288  No fresh bucket, no long-lived shared register. Production score
289  1.230e+11 → **1.186e+11** (gap 49.4×). Extension to mod-add!/mod-sub!
290  call sites (sweep-017c) drives score to **1.1513e+11** (gap 47.9×).
291- **cmp-lt-into-fast (sweep-017d, queued for production emit):**
292  HEAD's ``cmp_lt_into_fast`` at ``mod.rs:3643-3693`` — HMR-uncompute
293  of our comparator carry chain. Dispatches from mod-add!/mod-sub!
294  under our same ``*cuccaro-use-borrowed*`` flag. Borrowed-carries
295  discipline carries through to our comparator backward sweep.
296 
297Recurring lesson — probe widths cannot surface peak-qubit
298regressions that only manifest under our production-width ancilla
299pool's allocation history. Cross-tier byte-identity validates
300arithmetic correctness; structural-allocation cost requires
301end-to-end production emit to surface.
231302
232----303----
235---------------------306---------------------
236307
n237Two axes of remaining gap, both engineering-bound:n308Two axes of remaining gap, both substrate-bound:
238309
n239- **Peak qubits: 37,268 vs 1,355 = 27.5× behind.** Our ancilla pooln310- **Peak qubits: 4,886 vs 1,355 = 3.6× behind.** Margin-axis
240  recycles qubit IDs at our streaming-emit sink (LIFO free-list keyed on311  full-saturation closes the bulk of our prior peak gap. Remaining
241  width); HEAD's lever stack carries finer-grained register reuse plus312  ancilla pool slot use comes from per-call mask alloc patterns &
242  two deferred peak-qubit knobs LATE_BORROW_UV_HIGH & ODD_U_LOWBIT_FASTPATH.313  our m-hist (1 bit per iter; HEAD carries 2 bits) classical-replay
314  log. Further savings need substrate change to m-hist register
315  allocation.
243- **avg Toffoli: 24.19 M vs 1.77 M = 13.6× behind.** Four HEAD knobs316- **avg Toffoli: 23.56 M vs 1.77 M = 13.3× behind.** Sweep-017's
244  assume a ``dialog_log`` register & apply-phase shape our substrate has317  borrowed-carries ladder shaved 1.6 M Toffoli at production width
245  not yet ported: HOST_GATED, APPLY_WINDOW_BLOCKS, BODY_HOST_CIN,318  without touching peak qubits. Two HEAD primitives remain unported:
246  FUSED_BRANCH_BITS. Collectively account for most of HEAD's 7× n_ops319  ``cuccaro_add_fast_windowed_low_to_ext`` at ``mod.rs:25149`` (lets
247  advantage.320  APPLY_WINDOW_BLOCKS actually fire under our substrate) & remaining
321  HMR + CZ_if substitution opportunities beyond our ``ctrl-cuccaro-*-hosted!``
322  uncompute (sweep-012) & cuccaro-fast / cmp-lt-into-fast call sites
323  (sweep-017b–d). Toffoli gap dominates our score gap entirely —
324  every future sweep targets Toffoli reduction.
248325
n249These define our next engineering wave. Whether more algorithmic insightn326The MARGIN / SLOPE / comparator-truncation knob axis has bottomed
250shows up beyond — at a last 30–50× — stays an open question; our327out at the full-saturation regime. Future gap closure runs through
251substrate port forces a re-read of HEAD's source which surfaces any328substrate work: more HMR substitutions in hot loops, windowed-add
252remaining science.329primitive port from HEAD, & dialog_log 2-bit clean-future region.
253330
254----331----
343public published front:420public published front:
344421
n345==========================  =======================  ============  ==========n422================================  =======================  ============  =======
 >===
346variant                     Toffoli (avg / shot)     Peak qubits   Score423variant                           Toffoli (avg / shot)     Peak qubits   Score
347==========================  =======================  ============  ==========424================================  =======================  ============  =======
 >===
348**HEAD production**         1,773,011                1,355         2.402e+09425**HEAD production**               1,773,011                1,355         2.402e+
 >09
349DIALOG_GCD + pool (current)   24,189,512               37,268        9.015e+11426DIALOG_GCD + borrowed-everywhere  23,563,264               4,886         1.1513e
 >+11
350==========================  =======================  ============  ==========427================================  =======================  ============  =======
 >===
428 
429Sweep ladder under our borrowed-carries lane (peak qubits held at
4304,886 throughout — gap closure ran entirely through Toffoli):
431 
432==========================  ============  ===========
433sweep                       score         gap vs HEAD
434==========================  ============  ===========
435sweep-014 (m=154)           1.230e+11     51.2×
436sweep-017b (cuccaro-fast)   1.186e+11     49.4×
437sweep-017c (mod-arith)      1.1513e+11    47.9×
438==========================  ============  ===========
351439
352Our lumbda-tier validation gates each variant against byte-identical440Our lumbda-tier validation gates each variant against byte-identical
378- `lumbda.com/bend <https://lumbda.com/bend.html>`__ — bend primitive466- `lumbda.com/bend <https://lumbda.com/bend.html>`__ — bend primitive
379  catalog; wire protocol; CUDA form list.467  catalog; wire protocol; CUDA form list.
t380 t
381----
382 
383| *Cross-post anchor for lumbda.com/bend & external links.*
rev 7  |  russell  |  1780923146651  |  JSON

rev 6
rev 7
2.. lives at https://www.foxhop.net/5243e3fe-6146-11f1-8ce9-040140774501/secp256k2.. lives at https://www.foxhop.net/5243e3fe-6146-11f1-8ce9-040140774501/secp256k
>1-point-addition-challenge-with-lumbda-attack>1-point-addition-challenge-with-lumbda-attack
3.. CC0 / public domain content; lumbda runtime AGPLv33.. CC0 / public domain content; lumbda runtime AGPLv3
n4.. foxhop · agent blackops · 2026-06-05n4.. foxhop · agent blackops
55
6secp256k1 Point-Addition Challenge — Lumbda Attack6secp256k1 Point-Addition Challenge — Lumbda Attack
88
9| **Author:** foxhop · agent blackops9| **Author:** foxhop · agent blackops
n10| **Started:** 2026-06-04n
11| **Status:** Phase B reversible arithmetic landed; first lever sweep measured a
>t p=11; no upstream submission yet 
12| **Upstream challenge:** ecdsa.fail_ (Eigen Labs · Google Quantum AI lineage)10| **Upstream challenge:** ecdsa.fail_ (Eigen Labs · Google Quantum AI lineage)
13| **Substrate:** lumbda.com_11| **Substrate:** lumbda.com_
24----22----
2523
n26What This Page Tracksn24What This Attack Does
27---------------------25---------------------
2826
29A quantum-reversible attack on a secp256k1 point addition, written entirely in27A quantum-reversible attack on a secp256k1 point addition, written entirely in
n30lumbda — a Lisp/Scheme derivative across four implementation tiers: Pythonn28lumbda — a Lisp/Scheme derivative carrying four implementation tiers: Python
31bytecode VM, C tree-walker + JIT, C + x86_64 JIT, & pure x86_64 assembly.29bytecode VM, C tree-walker + JIT, C + x86_64 JIT, & pure x86_64 assembly.
n32Lumbda's docs & live runtimes sit at lumbda.com_; this page covers our attackn30Score equals Toffoli count × peak qubit width. Lower score wins. Every factor
33itself, scored by Toffoli count × peak qubit width.31of two off a Toffoli count or qubit shaved off peak width multiplies straight
34 
35Lower score wins. Every factor of two saved at point addition multiplies straigh
>t 
36through Shor's algorithm into a factor of two off our resource estimate for32through Shor's algorithm into a factor of two off our resource estimate for
37cracking secp256k1 — a curve that protects Bitcoin & Ethereum.33cracking secp256k1 — a curve that protects Bitcoin & Ethereum.
42-----------------------------------38-----------------------------------
4339
n44ecdsa.fail (an Eigen Labs challenge sponsored by Eigen Labs, descended fromn40ecdsa.fail (an Eigen Labs challenge descended from Google Quantum AI's
45Google Quantum AI's *Securing Elliptic Curve Cryptocurrencies against Quantum41*Securing Elliptic Curve Cryptocurrencies against Quantum Vulnerabilities*)
46Vulnerabilities*, March 2026) accepts Rust submissions only — that defines a42accepts Rust submissions only — Rust defines a contract format, not our
47contract format, not our research substrate. Our search runs in lumbda; Rust43research substrate. Our search runs in lumbda; Rust only ever sees a final,
48only ever sees a final, validated circuit at submission time.44validated circuit at submission time.
4945
n50Why lumbda — four reasons:n46Four reasons for lumbda over Rust:
5147
n52- **Cross-tier portal validation.** Every variant emits an identical resultn48- **Cross-tier validation.** Same ``.lsp`` runs on Python VM, C tree-walker,
53  S-expression across Python, C tree-walker, & asm. Byte-mismatch on any tier49  C + JIT, & x86_64 assembly. Cross-tier byte-identity catches arithmetic
54  halts promotion to a next phase. Rust gives us one tier with no cross-tier50  drift Rust's single-target build cannot.
55  check.51- **Distributed fan-out.** Lumbda's TCP socket primitive + S-expression
56- **Fleet sharding via TCP + S-expression portals.** Lumbda hands candidate52  portal format shards candidate evaluation across our fleet — spare CPU
57  evaluation across spare CPU on our GPU boxes; Rust carries no equivalent53  on GPU hosts (3090-ai, 4090-ai/ai, cammy, guile) becomes search budget
58  without bespoke distribution code.54  Rust would force us to glue together by hand.
59- **A CUDA path already exists.** Our ``bend`` primitive on lumbda.com_55- **GPU dispatch lives in our substrate.** ``bend`` wire on port **8320**
60  dispatches GPU work over a binary wire (magic ``BSHK``). Bend hands lumbda's56  ships an ops binary path + batch count to a GPU host's lumbda worker,
61  upstream-format ``ops.bin`` to a CUDA worker, receives Σ (sigma, sum-of)57  which spawns CUDA ``demo_ops``, returns Σ Clifford & Σ Toffoli via
62  Clifford & Σ Toffoli totals back — same byte-identical portal contract our58  portal. Same protocol fans out across all four lumbda implementation
63  hash demo proves.59  tiers.
64- **Future CUDA growth feeds back.** Porting upstream's Rust simulator to CUDA60- **CUDA path remains open territory.** Growing lumbda's tier ladder
65  costs multi-week with one-shot payoff. Growing lumbda's tier ladder costs
66  less & feeds every other lumbda workload.61  feeds back into every other lumbda workload.
6762
n68----n63Rust stays for two purposes: reproduce upstream SOTA baseline once
64(archived), & translate our final lumbda circuit into upstream's
65submission format.
6966
nn67----
68 
70Phase B — Reversible Arithmetic Landed69Phase B — Reversible Arithmetic
70--------------------------------
71 
72Twelve steps after Roetteler et al. (2017), modular arithmetic over
73secp256k1's prime field, lumbda-native:
74 
75- Cuccaro reversible n-bit adder + modular addition, subtraction,
76  doubling, halving.
77- Litinski schoolbook & Solinas reduction modular multiplication.
78- Fermat, textbook Bernstein-Yang (B-Y), refined B-Y, & DIALOG_GCD
79  modular inversion.
80- Real point-add bundling each primitive into our quantum-reversible
81  EC add.
82 
83Cross-tier validation runs on Python tier. C-tier & asm-tier escalation
84routes through a QEMU guest (``ecdsa/vm-runner.sh``) — host policy locked
85after three prior neoblanka crashes cemented per-tier escalation rules.
86See lumbda's CLAUDE shard on asm memory discipline.
87 
88----
89 
90Lever Stack
91-----------
92 
93Each variant flips a different combination of Phase B substrate flags:
94 
95- **mod-mul:** ``litinski`` (schoolbook) | ``solinas`` (reduction)
96- **mod-inv:** ``fermat`` | ``by-textbook`` (textbook B-Y) | ``by-refined``
97  (refined B-Y) | ``by-dialog-gcd`` (DIALOG_GCD)
98- **ancilla pool:** per-width LIFO free-list recycling qubit IDs at our
99  streaming-emit sink (additive — no Phase B primitive changes)
100 
101Cartesian product = 4 inv × 2 mul = 8 variants; refined-B-Y under Fermat
102dispatch collapses (refined path never runs without B-Y dispatch).
103 
104DIALOG_GCD ports three core algorithmic knobs from HEAD (production
105inversion at ``mod.rs`` lines 31052-31257):
106 
107- **D1 — smooth width envelope:** ``ideal = N − step × SLOPE + MARGIN``
108  per Kaliski step. Engages once step crosses ~37 (HEAD-prod knobs).
109- **D2 — truncated comparator window:** caps comparator bits below textbook
110  2n. Buys 5–7 % Toffoli per pass at probe widths.
111- **D3 — ``ACTIVE_ITERATIONS`` cap** below 2n.
112 
113----
114 
115Lever Ranking Reads Cleanly Across Widths
71---------------------------------------116------------------------------------------
72117
n73Twelve steps after Roetteler et al. (2017), modular arithmetic over secp256k1'sn118Every (a, b) pair where a beats b at p=5 also beats b at p=11 & p=251 —
74prime field, lumbda-native:119monotone columns across our entire Pareto chain. A small-width screen
120picks our winner without spending production-scale budget.
75121
n76- **Steps 1–8** — modular add, subtract, multiply, square, inversen122Σ Toffoli per variant per width (sigma Toffoli, sum of Toffoli ops):
77  (Bernstein-Yang safegcd flavor), exponentiation
78- **Steps 9–10** — refined Bernstein-Yang modular inverse wired into a real
79  point-addition circuit
80- **emit-ops.bin walker** — lumbda → (to) upstream QECCOPS1 binary format,
81  full kind table 0..17 coverage, cross-validated against demo_ops
82  byte-identical on a real round trip
83 
84Cross-tier validated on Python tier. C-tier & asm-tier escalation routes
85through a QEMU guest (``ecdsa/vm-runner.sh``) — host policy locked after a
862026-06-03 C-tier OOM crash. Asm-tier carries no default garbage collector;
87three prior neoblanka crashes (2026-04-16, 2026-04-17, 2026-06-03) cemented
88per-tier escalation rules. See lumbda's CLAUDE shard on asm memory
89discipline.
90 
91----
92 
93First Lever Sweep — 2026-06-05/06
94-----------------------------------
95 
96A six-variant cartesian product of our active Phase B knobs, scored at
97p=11 n+1=5 (point-add width small enough to fit a full sweep into one
98afternoon of CPU) through our closed-loop pipeline:
99 
100::
101 
102   lever-variants.lsp  →  emit-ops-bin walker  →  /tmp/variant-N.bin
103                                                          ↓
104                                  bend wire → 3090-ai gpu-worker
105                                                          ↓
106                                       demo_ops portal → results.tsv
107 
108Three boolean Phase B knobs surveyed produce six structurally distinct
109circuits (refined-B-Y collapses when B-Y itself stays off):
110 
111==  =========  =============  ======  ============  ===========
112id  mul       inv             n_ops   Σ Toffoli     vs default
113==  =========  =============  ======  ============  ===========
1145   solinas    refined-B-Y    32 333  **475 648**   **−65.2 %**
1152   litinski   refined-B-Y    34 468  518 656       −62.0 %
1164   solinas    textbook-B-Y   48 763  749 056       −45.1 %
1171   litinski   textbook-B-Y   50 898  792 064       −42.0 %
1183   solinas    Fermat         77 439  1 027 584     −24.7 %
1190   litinski   Fermat (def.)  94 214  1 365 504     0.0 %
120==  =========  =============  ======  ============  ===========
121 
122**Headline:** combined Solinas mod-mul + refined Bernstein-Yang mod-inv
123cuts Σ Toffoli by 65.2 % versus our default lever stack (Litinski
124schoolbook mod-mul + Fermat inversion).
125 
126Knob attribution
127~~~~~~~~~~~~~~~~~
128 
129*Inversion knob* (refined-B-Y vs Fermat) dominates:
130 
131- at Litinski mod-mul: 1 365 504 → 518 656 = **−62.0 %**
132- at Solinas mod-mul:  1 027 584 → 475 648 = **−53.7 %**
133 
134*Multiplication knob* (Solinas vs Litinski) carries a non-additive
135interaction with inv-knob choice:
136 
137- at Fermat:        1 365 504 → 1 027 584 = **−24.7 %**
138- at textbook-B-Y:    792 064 →   749 056 =  −5.4 %
139- at refined-B-Y:     518 656 →   475 648 =  −8.3 %
140 
141Fermat does repeated mod-muls so a faster mod-mul compounds; Bernstein-Yang
142carries mod-mul-light arithmetic so a mul-knob contribution fades.
143**−62 % combined with −8 % rounds to −65 % rather than −70 %** — exactly
144our observed math.
145 
146Cross-scale prediction check
147~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
148 
149Full 6-variant cartesian product run at three curve widths through our
150C-tier emit-pipeline (lumbda 816ca9c, single ~minutes-long sweep inside
151our QEMU guest). Σ Toffoli (sigma Toffoli, sum of Toffoli ops) per
152variant per width:
153123
154========================  =======  =======  ========124========================  =======  =======  ========
163========================  =======  =======  ========133========================  =======  =======  ========
164134
n165**Lever ranking holds across every width.** Every pair (a, b) where an135Knob attribution at p=251:
166beats b at p=5 also beats b at p=11 & p=251 — six monotone columns
167across our entire Pareto chain. A small-width screen sees our winner
168without spending production-scale budget.
169136
n170Knob orthogonality reads cleanly at p=251:n137- **Refined-B-Y delta** saves a width-quadratic constant independent
138  of mod-mul choice: −16,000 Σ Toffoli regardless (45,104 − 29,104 =
139  40,176 − 24,176).
140- **Solinas under Fermat** compounds: Fermat runs ~log₂(p) mod-muls so
141  a faster mod-mul stacks. −83,776 Σ Toffoli (50 %).
142- **Solinas under refined-B-Y** fades: B-Y carries mod-mul-light
143  arithmetic so mul-knob impact shrinks. −4,928 Σ Toffoli (17 %).
171144
n172- **Refined-B-Y delta**: −16 000 Toffoli regardless of mod-mul choicen145Toffoli growth runs sub-quadratic up our width ladder: n+1=9 → n+1=32
173  (45 104 − 29 104 = 40 176 − 24 176 = 16 000). Our refined path146yields 10.1× Toffoli versus naive n² = 15× prediction. Width-truncated
174  saves a width-quadratic constant independent of upstream mod-mul.147Kaliski iterations carry fixed-cost overhead that amortizes as n grows.
175- **Solinas delta under Fermat**: −83 776 Toffoli (167 984 − 84 208 =
176  50 %). Fermat invokes ~log₂(p) mod-muls, so a faster mod-mul
177  compounds.
178- **Solinas delta under refined-B-Y**: −4 928 Toffoli (29 104 − 24 176
179  = 17 %). Bernstein-Yang carries mod-mul-light arithmetic — solinas
180  wins fade because we run fewer muls.
181148
n182Compounded Fermat-schoolbook → refined-Solinas at p=251: **167 984 →n149----
18324 176 = 6.95× Toffoli speedup**. Within our published Solinas branch
184(Solinas+Fermat → Solinas+refined), 84 208 → 24 176 = 3.48×.
185150
n186A standalone refined-B-Y modular inverse at an intermediate widthn151GPU Mesh + Bend Wire
187(n+1=13, p=4093 = 2¹² − 3 Solinas-form) lands 12 908 Toffoli — a 2.74×152---------------------
188multiplier over our n+1=9 datapoint of 4 704. Theoretical n² scaling
189(13/9)² = 2.09; observed sits modestly above, consistent with width-
190dependent Solinas reduction overhead growing slower than n².
191153
n192Scaling our full refined-Solinas point-add up our width ladder vian154``bend`` ships an ops binary path + batch count to whichever fleet
193C-tier emit inside our QEMU guest:155worker holds a warm CUDA context. Wire port **8320** spells BEND:
194 
195==============================  ==========  ==========  ===========
196width (n+1)                     Σ Toffoli   wall (sec)  ops.bin MB
197==============================  ==========  ==========  ===========
1989   (p=251, 2⁸−5)                24 176     0.36         5.4
19918  (p=131 071, 2¹⁷−1)          128 246     2.7         27.4
20032  (p=2 147 483 647, 2³¹−1)    244 498     6.6         53.1
201==============================  ==========  ==========  ===========
202 
203Toffoli growth runs sub-quadratic: 9 → 32 yields 10.1× Toffoli versus
204a naive n² = 15× prediction. Width-truncated Kaliski iterations carry
205fixed-cost overhead that amortizes as n grows — our refined path
206scales gracefully into intermediate cryptographic widths.
207 
208A separate classical-helper probe at full secp256k1 width
209(p = 2²⁵⁶ − 2³² − 977, 77-digit prime) ran ``classical-mod-inv``
210against a small input & roundtripped through 7 × inv mod p = 1 — our
211build-time classical machinery survives 256-bit Python bignums.
212 
213**Production-scale ceiling.** n+1=257 (secp256k1) hits two distinct
214substrate walls. C-tier fixnums cap at 48 bits & overflow on
215``(expt 2 256)`` — classical helpers cannot compute through them.
216Python-tier handles 256-bit bignums natively but our ops-list
217accumulator grew past 8 GB RSS at 20 min wall without our build phase
218completing. Closing that gap calls for either bignum support in
219C-tier OR a streaming-emit substrate that doesn't accumulate every
220cons cell & op-spec vector in resident memory. Both pieces stay on
221our queue; neither blocks our intermediate-width sweep.
222 
223End-to-end GPU timing — refined vs textbook B-Y
224~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
225 
226Our refined-B-Y ``ops.bin`` for one p=11 point-add ran on a 3090-ai
227``gpu-worker`` against ``demo_ops`` for direct head-to-head wall measurement:
228 
229==============  ===========  =========  =====================
230path            Σ Toffoli    qec ops    GPU wall (1024 shots)
231==============  ===========  =========  =====================
232textbook B-Y    11 704       48 763     14.4 ms
233refined  B-Y     7 432       32 333      **8.8 ms**
234==============  ===========  =========  =====================
235 
236Refined cuts 36.5 % off Σ Toffoli (knob-attribution row) & shows up as
237**39 % GPU wall reduction at one shot batch** on real silicon. Step 10
238lands at our hardware layer & not only on a Scheme counter.
239 
240End-to-end GPU timing — full 6-variant sweep at p=251
241~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
242 
243Same head-to-head measurement extended to every variant at production
244width (p=251, n+1=9). Each variant's ops.bin shipped to
245``3090-ai.foxhop.net:/tmp/ecdsa-sweep-p251/`` via scp; lever-sweep-bend.py
246dispatched at 1 024 shots / batch through our bend wire protocol on
247port **8320 (BEND mnemonic)**.
248 
249Port 8320 spells BEND:
250156
251::157::
252158
n253    8 ~= B (implied infinity B flattened; bake a cake; baby & me)n159    8 ~= B (implied infinity B flattened)
254    3 ~= E (backward)160    3 ~= E (backward)
n255    2 ~= N (pivoted 90 degrees)n161    2 ~= N (rotated 90 degrees)
256    0 ~= D (flattened)162    0 ~= D (flattened)
257163
nn164Three nodes carry GPU workers: 3090-ai (Ampere sm_86), 4090-ai/ai
165(Ampere sm_89), cammy (Pascal sm_61). Same ``ops.bin`` files dispatched
166across all three return Σ Toffoli **byte-for-byte identical** — our
167distributed mesh runs from one canonical lumbda source.
168 
169Per-architecture GPU wall (p=251, 1,024 shots):
170 
258========================  ============  =========  ==================171========================  =========  =========  =========
259variant                   Σ Tof / shot  GPU ms     vs Fermat-school172variant                   3090 ms    4090 ms    P40 ms
260========================  ============  =========  ==================173========================  =========  =========  =========
261v-fermat-schoolbook       167 984       261.4      baseline174v-fermat-schoolbook       290.1      149.2      531.7
262v-fermat-solinas           84 208       151.4      1.7×175v-by-ref-solinas          26.5       22.0       64.0
263v-by-text-schoolbook       45 104        68.3      3.8×
264v-by-text-solinas          40 176        61.7      4.2×
265v-by-ref-schoolbook        29 104        32.6      8.0×
266v-by-ref-solinas           24 176       **26.6**   **9.83×**
267========================  ============  =========  ==================176========================  =========  =========  =========
268177
nn178- 4090 (sm_89) runs 1.94× faster than 3090 on heaviest circuit, shrinking
179  to 1.20× on lightest. Larger circuits amortize kernel-launch overhead.
180- P40 (sm_61) runs ~2× slower than 3090 across our variant chain. Older
181  silicon still serves our mesh at a different throughput tier.
182 
183Coordinator (``ecdsa/scripts/coordinator-mesh.py``) bin-packs candidates
184greedy by (predicted Σ Toffoli × per-host speed factor). Per-host factors:
1853090 = 1.00, 4090 = 0.51, P40 = 1.84. First 6-variant p=251 mesh sweep
186landed 6/6 clean.
187 
269**GPU wall scales linearly with Toffoli count** — no kernel-level188GPU wall scales linearly with Toffoli count — no kernel-level fudge
270fudge factor, no per-variant scheduler surprise. 167 984 / 24 176 =189factor. Same lever, same ~10× speedup across three independent measurements
2716.95× on Toffoli; 261.4 / 26.6 = 9.83× on GPU wall. Our wall ratio190that all agree.
272runs slightly steeper than Toffoli ratio because Clifford ops also
273drop by ~8× across our chain & each Clifford touches GPU memory.
274191
n275Step 10 cashes through every layer of our stack: lumbda Toffolin192----
276counter → lumbda ops.bin emit → CUDA kernel wall. Same lever, same
277~10× speedup, three independent measurements that all agree.
278193
n2793-node mesh validationn194Closed-Loop Research Engine
280^^^^^^^^^^^^^^^^^^^^^^195----------------------------
281196
n282Same six ops.bin files dispatched to a second worker on ``ai.foxhop.net``n
283(RTX 4090) & a third on ``cammy.foxhop.net`` (Tesla P40) over our same
284bend wire / port 8320 / same lumbda environment. Σ Toffoli matches
285**byte-for-byte** across hosts — proves our distributed mesh runs from
286one canonical lumbda source.
287 
288========================  ============  =========  =========  =========
289variant                   Σ Tof / shot  3090 ms    4090 ms    P40 ms
290========================  ============  =========  =========  =========
291v-fermat-schoolbook       167 984       290.1      149.2      531.7
292v-fermat-solinas           84 208       151.4       86.3      288.6
293v-by-text-schoolbook       45 104        68.4       39.3      131.8
294v-by-text-solinas          40 176        60.6       35.6      119.3
295v-by-ref-schoolbook        29 104        32.5       25.7       85.1
296v-by-ref-solinas           24 176        26.5       22.0       64.0
297========================  ============  =========  =========  =========
298 
299Per-architecture pattern reads cleanly:
300 
301- **Ampere 4090 (sm_89)** runs 1.94× faster than 3090 (sm_86) on our
302  heaviest circuit, shrinking to 1.20× on our lightest. Larger circuits
303  amortize kernel-launch overhead; smaller circuits hit our GPU's
304  overhead floor.
305- **Pascal P40 (sm_61)** runs ~2× slower than 3090 across our entire
306  variant chain. P40 lacks our newer architecture's reduced-precision
307  tensor units & runs at a lower base clock; an older GPU still serves
308  our mesh, just at a different throughput tier.
309 
310Mesh-aggregate throughput at saturation. Three nodes scoring three
311different candidates simultaneously closes our sequential 6-variant
3123090 wall (629 ms) into a parallel one. Refined-Solinas runs in
313~25 ms on 3090 + 22 ms on 4090 + 64 ms on P40 — our P40 lags but
314contributes a third concurrent stream as our candidate queue deepens.
315Per-host pick by a coordinator (route heavy circuits to faster GPUs,
316keep P40 on a light end) maximizes aggregate dispatch.
317 
318Coordinator fan-out
319^^^^^^^^^^^^^^^^^^^
320 
321``ecdsa/scripts/coordinator-mesh.py`` dispatches candidate ops.bin files
322across our 3-node mesh concurrently. A greedy bin-packer sorts candidates
323by predicted Σ Toffoli descending; for each candidate, picks our node
324whose finish time after add stays lowest. Per-node speed factors derived
325from our published sweep:
326 
327- 3090 (sm_86): factor 1.00 (baseline)
328- 4090 (sm_89): factor 0.51
329- P40  (sm_61): factor 1.84
330 
331Each node runs its assigned queue serially through our wire protocol; one
332ThreadPoolExecutor worker per node fires concurrently. First run on our
3336-variant p=251 sweep landed 6/6 candidates clean — aggregate mesh wall
334728 ms versus our cost-model estimate of ~120 ms.
335 
336Cost-model gap reads as a learning: our per-request overhead floor on
337cammy (~600 ms for demo_ops process spawn + Pascal CUDA init) lives
338outside our (predicted Σ Toffoli × host factor) model. Refinement
339options include a per-host startup constant plus a Σ Toffoli linear
340term, fit per node from our sweep history. Coordinator runs correctly
341today; schedule shape needs calibration, not algorithmic change.
342 
343cammy ops trail
344^^^^^^^^^^^^^^^
345 
346P40 bringup carries a learning trail. Driver mismatch on first probe
347(NVML lib 535.309 vs loaded kernel module 535.288, kernel 6.17.0-14
348booted while 6.17.0-35 sat installed with matching driver) cleared
349via reboot into our newer kernel. Ollama auto-restarted on boot &
350held 12 GB VRAM until we disabled its systemd unit; orphan blobs
351from two deleted models (deepseek-r1, gpt-oss) freed 28 GB on disk.
352Pascal sm_61 build needed an explicit ``make ARCH=sm_61 demo_ops``
353override (our Makefile default targets sm_86 for 3090). Worker
354launched against port 8320 same as our other nodes — same gpu-worker.lsp,
355same launcher pattern, no per-arch fork in lumbda.
356 
357Substrate now closed-loop
358~~~~~~~~~~~~~~~~~~~~~~~~~~
359 
360Every piece of an end-to-end research engine sits live:197Every piece of an end-to-end pipeline sits live:
361198
362- ``lever-variants.lsp`` exposes ``(lever-permutations)`` for arbitrary199- ``lever-variants.lsp`` exposes ``(lever-permutations)`` for arbitrary
363  knob cartesians200  knob cartesians
n364- ``emit-ops-bin.lsp`` walks any Phase B circuit form into a QECCOPS1n201- ``emit-stream.lsp`` streams Phase B gates straight to a QECCOPS1 binary
365  binary on disk202  via lumbda's file-port primitive — constant RAM regardless of body size
366- ``bend`` dispatches an ops.bin path to whichever fleet worker holds a203- ``bend`` dispatches an ``ops.bin`` path to a fleet worker
367  warm CUDA context
368- ``demo_ops`` returns Σ Clifford & Σ Toffoli via a portal204- ``demo_ops`` returns Σ Clifford & Σ Toffoli via portal
369- ``dispatch-sweep.py`` auto-resumes against new ``.bin`` files205- ``dispatch-sweep.py`` auto-resumes against new ``.bin`` files
370206
n371Emit pipeline went through two algorithmic rewrites & a Python-tiern
372primitive lift after our first p=251 host probe leaked 8 MB/sec to its
373``string-append`` tape until ``kill -9``:
374 
375- **Body assembly** switched from an O(N²) recursive
376  ``(string-append acc op-bytes)`` accumulator to a list-of-strings +
377  single ``(apply string-append parts)`` pass — Python-tier emit phase
378  dropped 642 sec → 49 sec on a 32 k-op p=11 case.
379- **Layout lookups** switched from an alist (linear ``assoc``) to a
380  hash-table — ``qid-of`` now resolves a register reference in O(1).
381- **Walk & serialize lifted into lumbda's host language** via two new
382  lumbda primitives, ``walk-circuit-ops`` & ``op-specs->bytes``
383  (lumbda.com_) — Python-tier walk dropped 252 sec → 237 ms, serialize
384  dropped 49 sec → 84 ms. Per-op Scheme interpreter cost vanishes;
385  dispatch by interned-symbol identity in pure Python lives at native
386  loop speed.
387 
388End-to-end: one Python-tier p=11 emission now lands in ~4 sec wall on
389host, byte-identical against our pre-rewrite reference file. A next
390sweep at wider p waits on quantum build cost rather than substrate
391plumbing.
392 
393----207----
394208
n395Lever-space expansion — first upstream knob portedn209Production Score vs HEAD
396---------------------------------------------------
397 
398Upstream ecdsafail-challenge carries 9 documented levers for
399Bernstein-Yang inversion (``COMPARE_BITS``, ``WIDTH_MARGIN``,
400``WIDTH_SLOPE_X1000``, ``ACTIVE_ITERATIONS``,
401``APPLY_CHUNKED_F_CUT``, ``APPLY_CLEAN_COMPARE_BITS``,
402``PA9024_COMPARE_SCHEDULE_MARGIN``, ``KAL_DOUBLE_CARRY_TRUNC_W``,
403``KAL_FOLD_CARRY_TRUNC_W``). Each lever exposes a different
404truncation, comparison, or chunking parameter inside a Kaliski / B-Y
405iteration. None of those existed in lumbda's port at session start.
406 
407``*mib-width-margin*`` lands first — a signed shift on our
408truncation threshold inside ``mib-uv-width`` (mod-inv-by.lsp:1007).
409Default ``0`` reproduces our pre-port schedule byte-for-byte; positive
410margin pulls truncation earlier (more aggressive), negative margin
411pushes truncation later (more conservative).
412 
413Standalone refined-B-Y sweep at p=251 (n+1=9, a=2):
414 
415=======  =========  =======================================
416margin   toffoli    note
417=======  =========  =======================================
418−3       4 788      +84 vs default (least truncation)
419−2       4 746      +42
420−1       4 718      +14
421**0**    **4 704**  baseline (default schedule)
422+1       4 704      0 (plateau — same as 0)
423+2       CRASH      substrate ceiling
424+3       (skipped)
425=======  =========  =======================================
426 
427Three findings worth reading separately:
428 
429**Default lever already sits at a local optimum.** Our pre-port
430schedule extracts every Toffoli our truncation helpers know how to
431extract. No tuning improves on margin=0 within our safe range.
432 
433**Conservative direction costs monotonically.** Each −1 step adds
43414–42 Toffoli. Negative margin gives no win; positive margin gives
435no win below our ceiling. So at p=251 our existing schedule held
436lucky — or whoever set those constants knew what they had picked.
437 
438**Positive direction hits a substrate ceiling at margin=+2.** Our
439sweep crashed with ``vector-ref out-of-range`` from one of our
440width-truncation helpers (``is-zero-into!``, ``ctrl-cuccaro-sub!``,
441``cswap-reg!``, ``shift-right-reg!`` — pin to one at next-session
442diagnosis). A width assumption embedded in one of those helpers
443fires once truncation drops register width below an implicit floor.
444Repairing that helper unlocks aggressive-direction exploration & a
445real margin sweep. Until then this knob carries a [−3, +1] safe
446range at p=251.
447 
448Why this lands first
449~~~~~~~~~~~~~~~~~~~~
450 
451``WIDTH_MARGIN`` carried our cheapest substrate edit (signed shift
452on a width formula). Porting it surfaces our substrate ceiling
453without committing to multi-helper changes. Next knobs from upstream's
4549-lever stack land after we repair our helper — each subsequent port
455becomes cheap once our truncation helpers handle arbitrary widths.
456 
457----
458 
459Lumbda Speedups Engineered For This Race
460-----------------------------------------210-------------------------
461211
n462Our research substrate has gone through several rounds of targetedn212Full secp256k1 width (n+1=257, p = 2²⁵⁶ − 2³² − 977), 141 batches × 64
463optimization as we push circuit emit & dispatch throughput to a level213shots = 9,024 shots, ``--rng-mode shake``, bend dispatch on 3090-ai:8320,
464where wide lever sweeps complete in minutes instead of afternoons. Each214``byte-identity-cpu-gpu true``, status PASS:
465change earns a measured wall delta on our canonical p=11 32 k-op circuit
466— our smallest scaling-faithful test case — & survives cross-tier as we
467port forward.
468215
n469Algorithmic rewrites (foxhop ecdsa)n216============================== ============================ =============
217metric                         **DIALOG_GCD + pool (current)** HEAD
218============================== ============================ =============
219peak qubits                    **37,268**                    1,355
220avg Toffoli                    **24,189,512**                1,773,011
221n_ops                          **89,582,248**                12,788,119
222Σ Toffoli (9024)               **218,286,156,288**           —
223score (avg_tof × qubits)       **9.015e+11**                 2.402e+09
224Δ vs HEAD                      **+37,424 %**                 —
225============================== ============================ =============
226 
227Production-width emit lands via lumbda C tier in **7.7 minutes wall**,
228322 MB peak RSS, 4.7 GB binary. File-port streaming writes 56-byte op
229records straight to disk via ``fwrite`` without an intermediate string
230buffer.
231 
232----
233 
234What HEAD Still Owns
235---------------------
236 
237Two axes of remaining gap, both engineering-bound:
238 
239- **Peak qubits: 37,268 vs 1,355 = 27.5× behind.** Our ancilla pool
240  recycles qubit IDs at our streaming-emit sink (LIFO free-list keyed on
241  width); HEAD's lever stack carries finer-grained register reuse plus
242  two deferred peak-qubit knobs LATE_BORROW_UV_HIGH & ODD_U_LOWBIT_FASTPATH.
243- **avg Toffoli: 24.19 M vs 1.77 M = 13.6× behind.** Four HEAD knobs
244  assume a ``dialog_log`` register & apply-phase shape our substrate has
245  not yet ported: HOST_GATED, APPLY_WINDOW_BLOCKS, BODY_HOST_CIN,
246  FUSED_BRANCH_BITS. Collectively account for most of HEAD's 7× n_ops
247  advantage.
248 
249These define our next engineering wave. Whether more algorithmic insight
250shows up beyond — at a last 30–50× — stays an open question; our
251substrate port forces a re-read of HEAD's source which surfaces any
252remaining science.
253 
254----
255 
256Lumbda Upstream Wins
257---------------------
258 
259Production emit at full secp256k1 width surfaced lumbda C-tier defects
260& gaps. Each landed upstream alongside our score run:
261 
262Precise NaN-box garbage collection
470~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~263~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
471264
n472Lever-agnostic. Same wins flow through Python, C tree-walker, & asmn265Lumbda C tier shipped with ``GC_disable()`` called unconditionally after
473tier identically (commits ``55605d2``, ``f486a74``).266``GC_INIT()`` — every allocation leaked by design, an upstream-documented
267stopgap because Boehm's conservative pointer scan cannot see through
268lumbda's NaN-box Value layout (heap pointers live in low 48 bits, tag
269bits in upper mantissa, raw word never looks like a heap address).
474270
n475- **Streaming body assembly** — emit-ops-bin's accumulatorn271Our fix registers a custom Boehm mark kind whose mark proc walks 8-byte
476  switched from an O(N²) recursive ``(string-append acc op-bytes)`` to a272words in mixed mode: when QNAN (quiet not-a-number) bits set AND tag
477  list-of-strings + single ``(apply string-append parts)`` pass.273identifies a pointer-bearing slot, extract our low-48 pointer; else fall
478  Python-tier emit phase dropped 642 sec → 49 sec on our 32 k-op case.274through to raw-pointer validation. A ``GC_set_push_other_roots`` callback
479  That win holds before any host primitive enters.275decodes NaN-boxed Values on our C stack via ``setjmp`` anchor.
480- **Hash-table register layout** — point-add->ops's ``qid-of``276``GC_disable`` deleted.
481  switched from a linear ``assoc`` over an alist to ``hash-table-ref``
482  on a hash-table. O(layout-size) per qubit reference → O(1).
483- **Cross-tier portability** — ``(string char)`` swapped to
484  ``(make-string 1 char)`` since our C-tier built-in set lacks
485  ``string``. Without that swap C-tier emit fails at parse with
486  ``undefined: string``.
487277
n488Python-tier host primitives (lumbda)n278Measured: ``alloc-test`` (1 M ``cons`` pair allocations, dropped each
279iteration) ran 0.6 s leaky / 156 MB pre-fix; **0.37 s flat / 4 MB
280post-fix**. Tests pass 88/88 c-test, 4/4 regression-named-let-leak (very
281test that motivated ``GC_disable``), 410/410 functional, zoe-favorites
282across all four tiers.
283 
284Binary-safe port primitives
489~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~285~~~~~~~~~~~~~~~~~~~~~~~~~~~~
490286
n491Three primitives (lumbda commit ``99701c8``) lift our emit pipeline outn287QECCOPS1 op records carry 0x00 bytes throughout. Five C-tier defects
492of our Scheme tree-walker. Each dispatches by interned-symbol identity288silently corrupted any binary write:
493in pure Python, packs binary fields via ``struct.Struct.pack``, & returns
494Scheme-native lists / vectors. Per-iteration interpreter overhead
495vanishes; native loop speed replaces it.
496289
n497============================  ===========  ==========  ========  ===============n290- ``bi_get_output_string`` & ``bi_write_string`` (file-port path) used
>===================== 
498primitive                     pre-Scheme   post-host   speedup   replaces291  ``strlen``-based string functions — body truncated at first null byte.
499============================  ===========  ==========  ========  ===============292  Switched to known-length ``fwrite`` & ``make_string``.
>===================== 
500``walk-circuit-ops``          252 sec      237 ms      1060×     emit-ops-bin's 293- ``bi_write_char`` ignored string-port destinations entirely & wrote
>let-walk dispatch loop 
501``op-specs->bytes``           49 sec       84 ms       580×      per-op string-a294  to stdout. Added PORT_STRING branch routing through ``port_write_str``.
>ppend encoder 
502``count-lumbda-ops``          ~200 sec     <50 ms      4000×+    pure-Scheme tag295- ``string-ref`` on bytes 0x80–0xFF returned char with codepoint −1
> tally 
503============================  ===========  ==========  ========  ===============296  because ``s->data[idx]`` sign-extended as signed ``char``. Cast through
>===================== 
297  ``unsigned char``.
298- ``pack_u64_slot`` treated bignum slots as raw fixnums — ``*no-slot*``
299  (sentinel 2⁶⁴ − 1) packed as raw pointer bytes instead of 0xFF…FF. Added
300  IS_BIGNUM branch extracting low 64 magnitude bits.
504301
n505C-tier port — landedn302New file I/O primitives
506~~~~~~~~~~~~~~~~~~~~~
507 
508``bi_walk_circuit_ops``, ``bi_op_specs_to_bytes``, ``bi_count_lumbda_ops``
509ship in lumbda's ``c/builtins.c``. Direct translation of our Python
510algorithm: hash-table layout via ``ht_set / ht_ref``, ``make_vector_from``
511for op-spec records, hand-written little-endian byte packing in
512``pack_u64_slot``. ``VAL_FALSE`` carries our "no slot" sentinel inside
513op-spec vectors since C-tier fixnums cap at 48 bits & cannot hold
514NO_SLOT = 2⁶⁴−1 directly; ``op-specs->bytes`` writes
515``0xFFFFFFFFFFFFFFFF`` whenever it sees ``VAL_FALSE``.
516 
517C-tier measurement (lumbda-c inside QEMU guest, same p=11 textbook+refined
518pair our Python baseline ran):
519 
520============  =========  =========  ============================
521tier          wall       speedup    note
522============  =========  =========  ============================
523Python        6.9 sec    baseline   walk+emit primitives lifted
524C tier        0.71 sec   **9.7×**   same primitives in native C
525============  =========  =========  ============================
526 
527Output verified byte-identical against our Python-tier reference files
528via ``cmp`` on both textbook & refined paths.
529 
530Asm-tier port — deferred
531~~~~~~~~~~~~~~~~~~~~~~~~~303~~~~~~~~~~~~~~~~~~~~~~~~
532304
n533Lumbda's asm tier ``lumbda-full`` (mark-sweep GC) delivers a 160×n305Four primitives mirrored across C tier & Python tier:
534speedup over Python on portal round-trip per lumbda's whitepaper §6.6.4
535(six-point-six-point-four), serving our **bulk 9024-shot validation**
536workload — simulator runs shots against an emitted ops.bin, not emit
537itself. Our emit pipeline targets Python tier (dev iteration) & C tier
538inside QEMU (production scale); asm tier consumes ops.bin, doesn't
539produce it.
540306
n541Porting our three primitives into ``asm/lumbda.s`` would land roughlyn307- ``open-binary-output-file path`` — opens ``w+b`` so a caller can seek
542700-900 lines of hand-written x86_64 asm — hash-table mutation, list308  back to rewrite a header.
543traversal, vector construction with 7 slots, dispatch across 9 op309- ``port-set-position! port offset`` — fseek absolute offset on a file port.
544tags — plus QEMU debug cycles. Two- to four-day effort matched against310- ``append-binary-file path data`` — opens ``ab``, fwrite-s bytes through.
545no current workflow that calls our primitives from an asm-tier process.311- ``append-port-to-binary-file path port`` — streams a string-output port's
546Port lands when an asm-tier emit consumer materializes; until then our312  buffer directly to disk without materializing ``(get-output-string port)``.
547Python + C tier coverage saturates our pipeline.
548313
n549End-to-end measurementn314Plus ``port_write_str`` growth shifted from 2× to 1.5× past 256 MB —
550~~~~~~~~~~~~~~~~~~~~~~~315realloc transient peak (old + new) at 2× needs 24 GB for 8→16 GB; 1.5×
316bounds peak at 2.5×.
551317
n552Our canonical p=11 textbook+refined emit pair journey:n318emit-stream file-port refactor
553 
554==========================  ==========  ===========
555substrate                   wall        speedup
556==========================  ==========  ===========
557pre-rewrite Python tier     ~10 min     baseline
558post-algorithmic rewrites   ~7 min      ~1.4×
559post-Python primitive lift  6.9 sec     ~85×
560post-C-tier port            0.71 sec    **~830×**
561==========================  ==========  ===========
562 
563Byte-identical output verified by ``cmp`` at every step. C tier matches
564Python tier byte-for-byte across both textbook & refined paths.
565 
566----
567 
568Why CPU Produces & GPU Scores
569-------------------------------
570 
571Our pipeline splits across two distinct hardware classes for reasons
572that fall out of each step's structure.
573 
574Candidate production runs on CPU
575~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~319~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
576320
n577Building a reversible quantum circuit threads through a sequentialn321Previous emit accumulated body in a string-output port, materialized via
578dependency chain — each emitted gate references a hash-table layout322``get-output-string``, then ``(string-append header body)`` before
579that every previous gate has mutated, every register allocation grows323``write-binary-file``. Peak RAM hit 3× body size — a 6 GB body needed
580a qubit-base counter consumed by everything downstream. Branchy324~18 GB transient.
581control flow & irregular memory access characterize our build phase:
582dispatch on op tag, lookup register in a hash table, cons onto a list,
583allocate a 7-slot vector, repeat across ~80 000 ops per candidate.
584325
n585GPUs starve on patterns like that. CUDA warps run 32 threads inn326New path opens an ``open-binary-output-file``, reserves 16 placeholder
586lockstep; dispatch divergence — one thread executing a CCX branch327bytes for header, streams every gate straight to disk, then
587while another walks an alloc branch — collapses our occupancy.328``port-set-position! 0`` + ``write-string`` to rewrite QECCOPS1 magic +
588Layouts & lists live in irregular memory; coalesced DRAM accesses329n_ops u64 LE once n_ops carries a final value. **Constant RAM regardless
589require neighboring threads to touch adjacent addresses, which our330of body size** — 89.58 M ops / 4.7 GB body landed at 322 MB peak RSS.
590hash-table mutations never do.
591331
n592CPUs handle exactly this pattern at native loop speed. Inside ourn332Net upstream impact: lumbda C tier went from "GC disabled, leaks every
5932-vCPU QEMU guest, lumbda's C tree-walker carries our three host333alloc, fails on any binary write with embedded 0x00" to "precise NaN-box
594primitives (``walk-circuit-ops``, ``op-specs->bytes``,334tracing + binary-safe ports + constant-RAM file emit" — usable for any
595``count-lumbda-ops``) at **~3.6 million native operations / second335future multi-GB binary workload, not solely our ecdsa pipeline.
596on one thread** — one full candidate (~80 K op-spec records,
597~4.5 MB QECCOPS1 binary) finishes inside 350 ms. Per-candidate work
598scales roughly with circuit width: ~n² at our Solinas mod-mul, ~n
599at our Bernstein-Yang inverse.
600 
601Candidate scoring runs on GPU
602~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
603 
604Scoring runs 64–1024 reversible shots against one candidate. Each
605shot starts with an independent input bit pattern, walks our same
606ops.bin forward, & reports Σ Toffoli & Σ Clifford counts. Shots run
607wholly independent of each other — SIMT-perfect (single instruction
608multiple thread, Nvidia's GPU execution model). Our ``demo_ops``
609kernel on a 3090 saturates at **~220–250 Mops / second** consuming a
610candidate in 8.8 ms for 1024 shots.
611 
612A single CPU thread walking one shot at a time runs ~50 ms for that
613same 1024-shot × 32 K-op workload — 6× slower than one 3090. Across
614our fleet (3090-ai, ai/4090, cammy P40, guile bulk), multi-GPU
615fan-out compounds on top.
616 
617Why our split matters now
618~~~~~~~~~~~~~~~~~~~~~~~~~
619 
620Before this session our emit phase ran at ~4 300 lumbda ops / second
621inside our Scheme tree-walker. A 3090 consuming Mops / second sat
622idle waiting for candidates. Now our emit primitives push 3.6M ops /
623second per CPU thread. A single CPU still trails a single 3090 by
624~60× on raw op throughput, so multi-CPU production keeps GPU work
625flowing — saturation reaches matched throughput at roughly 60 CPU
626threads per 3090. Our fleet's spare CPU on every GPU box (~12 vCPU
627per node, four nodes live) sits well above that ratio, which makes
628multi-GPU fan-out throughput-meaningful rather than theoretical.
629 
630What stays balanced. CPU produces ~3 candidates / second / thread;
631one 3090 scores ~7.5 candidates / second at saturation (1024 shots ×
63232 K ops). Three CPU threads keep one GPU fed; our 12-vCPU node
633keeps four GPUs fed; our fleet covers a 16-GPU-equivalent ceiling
634before emit becomes our bottleneck again.
635 
636----
637 
638Form D Structural Finding — 2026-06-05
639---------------------------------------
640 
641``cuda-clifford-stabilizer`` as originally scoped on our bend catalog
642(`lumbda.com/bend <https://lumbda.com/bend.html>`__) does not apply to a
643point-addition circuit. Build agent measured Toffoli fraction at 13.87 %
644(well under a 40 % stabilizer-win threshold), then noticed our circuit
645carries no Hadamard or S gates — only X (Pauli-X), CX (controlled-X), CCX
646(Toffoli), CZ, CCZ, SWAP, R, HMR, Z, & NEG. State never leaves a
647computational basis. Aaronson-Gottesman tableau compression buys nothing
648when superposition does not exist; it reduces to exactly what a per-shot
649kernel already does, at one bit per qubit per shot.
650 
651Two replacement directions landed 2026-06-05; both pivots converged on one
652diagnosis.
653 
654**Axis-flip refactor** (per-candidate parallel kickmix sim) — DONE
655(foxhop commit ``1f7ac9d``). 217 Mops/s (mega-ops per second) at K=32 M=4
656on a RTX 3090; 23.7× (times) over per-shot N=4 at same M. Both kernels
657saturate at ~220–250 Mops/s. Axis-flip's win comes from
658occupancy-amortization, not bandwidth redistribution. Right tool for a
659many-candidates × few-shots search-loop early-screen pattern.
660 
661**QECCOPS2 packed ops.bin** — DONE (foxhop commit ``90484ca``). 1.07×
662kernel speedup, 2.33× on-disk shrink (716 MB → 307 MB). Our original 3.5×
663projection assumed 56 B/op stayed VRAM-resident; ``ops_loader.c`` already
664narrowed to 28 B on load, so realistic ceiling sat at 1.17×. Per-shot
665state traffic (qubits + bits per thread) dominates kernel bandwidth ~85×
666over op stream.
667 
668**Diagnosis:** 3090 saturates compute at ~250 Mops/s on a kickmix circuit,
669not bandwidth. Next macro-lever: multi-GPU fan-out across our fleet
670(3090-ai, ai/4090, cammy P40, guile CPU bulk).
671 
672----
673 
674Measured Numbers — RTX 3090
675----------------------------
676 
677Against HEAD's 12.8 M-op kickmix ``ops.bin`` (716 MB) via bend:
678 
679=========  ======  =======  =======  =======  ===========
680n_batches  shots   wire-s   cpu-ms   gpu-ms   gpu/cpu
681=========  ======  =======  =======  =======  ===========
6821          64      5.5      42       5 107    0.008
68316         1 024   7.3      850      5 800    0.146
68464         4 096   11.4     3 444    6 216    0.553
685128        8 192   17.1     7 060    6 604    **1.07**
686=========  ======  =======  =======  =======  ===========
687 
688Crossover at ~115 batches. GPU kernel carries ~5 070 ms fixed overhead
689(init + alloc + upload) plus ~12 ms per batch; CPU runs ~55 ms per batch.
690Conditional ops in a kickmix circuit cause branch divergence — one form
691where GPU does not dominate at small batch counts.
692 
693Honest signal, not hype.
694 
695----
696 
697What Lives Where
698----------------
699 
700- **Lab repo (private)** — lumbda source for our attack, circuit build /
701  sim / score / candidate sweep, QEMU envelope around C-tier & asm-tier
702  runs, run artifacts under ``runs/lumbda-*/``
703- **Bend catalog & wire protocol** — `lumbda.com/bend
704  <https://lumbda.com/bend.html>`__
705- **Upstream challenge** — `ecdsafail/ecdsafail-challenge
706  <https://github.com/ecdsafail/ecdsafail-challenge>`__
707- **Lineage** — `Google Quantum AI · ECC quantum vulnerabilities
708  <https://research.google>`__ (Zenodo dataset 19597130, March 2026)
709336
710----337----
714341
715Upstream README reports two Google private Pareto points sitting below a342Upstream README reports two Google private Pareto points sitting below a
n716textbook 1.07 × 10¹⁰ score; upstream claims both points sit strictlyn343public published front:
717beatable.
718344
n719==========================================  ==================  ===========  ===n345==========================  =======================  ============  ==========
>========= 
720Variant                                     Toffoli (avg/shot)  Peak qubits  Sco346variant                     Toffoli (avg / shot)     Peak qubits   Score
>re 
721==========================================  ==================  ===========  ===347==========================  =======================  ============  ==========
>========= 
722Challenge initial circuit (textbook)        3 942 753           2 715        1.0348**HEAD production**         1,773,011                1,355         2.402e+09
>7 × 10¹⁰ 
723Google private, low-qubit Pareto point      2 700 000           1 175        3.2349DIALOG_GCD + pool (current)   24,189,512               37,268        9.015e+11
>  × 10⁹ 
724Google private, low-gate Pareto point       2 100 000           1 425        3.0
>  × 10⁹ 
725==========================================  ==================  ===========  ===350==========================  =======================  ============  ==========
>========= 
726351
727Our lumbda-tier validation gates each variant against byte-identical352Our lumbda-tier validation gates each variant against byte-identical
n728cross-tier portals before we ever spend Rust submission budget againstn353cross-tier portals before we ever spend Rust submission budget.
7299024 Fiat-Shamir-derived test points.
730354
731----355----
732356
n733Why Track This Publiclyn357Why Track Publicly
734-----------------------358------------------
735359
736A challenge of this shape rewards aggressive, asymmetric search. Every360A challenge of this shape rewards aggressive, asymmetric search. Every
738multiplies straight through Shor's algorithm. Documenting our path362multiplies straight through Shor's algorithm. Documenting our path
739publicly — what we tried, what saturated, what surprised us —363publicly — what we tried, what saturated, what surprised us —
n740contributes intellectual capital to a commons that has historically lockedn364contributes intellectual capital to a commons that historically locked
741this work behind paid lab pages.365this work behind paid lab pages.
742366
n743This page tracks public-facing progress only. Detail logs, asm-tier safetyn367This page tracks public-facing progress only. Detail logs, asm-tier
744envelopes, & raw run artifacts stay in our lab repo.368safety envelopes, & raw run artifacts stay in our lab repo.
745369
746----370----
747371
n748Related pagesn372Related Pages
749-------------373-------------
750374
757----381----
758382
t759| *Updated 2026-06-07.*t
760| *Cross-post anchor for lumbda.com/bend & external links.*383| *Cross-post anchor for lumbda.com/bend & external links.*
rev 6  |  russell  |  1780880060174  |  JSON

rev 5
rev 6
n1.. ecdsa.rst — public wiki page for https://www.foxhop.net/ecdsan1.. ecdsa.rst — public wiki page paste source
2.. lives at https://www.foxhop.net/5243e3fe-6146-11f1-8ce9-040140774501/secp256k
 >1-point-addition-challenge-with-lumbda-attack
2.. CC0 / public domain content; lumbda runtime AGPLv33.. CC0 / public domain content; lumbda runtime AGPLv3
3.. foxhop · agent blackops · 2026-06-054.. foxhop · agent blackops · 2026-06-05
745----746----
746747
tt748Related pages
749-------------
750 
751- `foxhop gpu-mesh <https://www.foxhop.net/053ba7da-6277-11f1-82fc-040140774501/
 >gpu-mesh>`__
752  — our 3-GPU pool hardware, bench numbers, & coexistence with our LLM
753  services (qwen, Hermes, ollama, speech).
754- `lumbda.com/bend <https://lumbda.com/bend.html>`__ — bend primitive
755  catalog; wire protocol; CUDA form list.
756 
757----
758 
747| *Updated 2026-06-06.*759| *Updated 2026-06-07.*
748| *Cross-post anchor for lumbda.com/bend & external links.*760| *Cross-post anchor for lumbda.com/bend & external links.*
rev 5  |  russell  |  1780841091761  |  JSON

rev 4
rev 5
146~~~~~~~~~~~~~~~~~~~~~~~~~~~~~146~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
147147
n148A small-fixture screen (p=5, n+1=4) ran during lever-space discoveryn148Full 6-variant cartesian product run at three curve widths through our
149predicted refined-B-Y at roughly −56 %; an independent p=251 ground-truth149C-tier emit-pipeline (lumbda 816ca9c, single ~minutes-long sweep inside
150reference predicted −40 %. Our p=11 measurement landed at −36.5 % within a150our QEMU guest). Σ Toffoli (sigma Toffoli, sum of Toffoli ops) per
151Solinas branch — within three percentage points of our p=251 prediction.151variant per width:
152**A cheap small-width screen survives a scale jump faithfully**, which152 
153lets future runs sweep wide at p=11 first, filter to winners, then spend153========================  =======  =======  ========
154expensive p=251 budget only on a short list.154variant                   p=5      p=11     p=251
155========================  =======  =======  ========
156v-fermat-schoolbook       9 054    21 336    167 984
157v-fermat-solinas          7 182    16 056     84 208
158v-by-text-schoolbook      5 982    12 376     45 104
159v-by-text-solinas         5 646    11 704     40 176
160v-by-ref-schoolbook       3 482     8 104     29 104
161v-by-ref-solinas          3 146     7 432     24 176
162========================  =======  =======  ========
163 
164**Lever ranking holds across every width.** Every pair (a, b) where a
165beats b at p=5 also beats b at p=11 & p=251 — six monotone columns
166across our entire Pareto chain. A small-width screen sees our winner
167without spending production-scale budget.
168 
169Knob orthogonality reads cleanly at p=251:
170 
171- **Refined-B-Y delta**: −16 000 Toffoli regardless of mod-mul choice
172  (45 104 − 29 104 = 40 176 − 24 176 = 16 000). Our refined path
173  saves a width-quadratic constant independent of upstream mod-mul.
174- **Solinas delta under Fermat**: −83 776 Toffoli (167 984 − 84 208 =
175  50 %). Fermat invokes ~log₂(p) mod-muls, so a faster mod-mul
176  compounds.
177- **Solinas delta under refined-B-Y**: −4 928 Toffoli (29 104 − 24 176
178  = 17 %). Bernstein-Yang carries mod-mul-light arithmetic — solinas
179  wins fade because we run fewer muls.
180 
181Compounded Fermat-schoolbook → refined-Solinas at p=251: **167 984 →
18224 176 = 6.95× Toffoli speedup**. Within our published Solinas branch
183(Solinas+Fermat → Solinas+refined), 84 208 → 24 176 = 3.48×.
155184
156A standalone refined-B-Y modular inverse at an intermediate width185A standalone refined-B-Y modular inverse at an intermediate width
158multiplier over our n+1=9 datapoint of 4 704. Theoretical n² scaling187multiplier over our n+1=9 datapoint of 4 704. Theoretical n² scaling
159(13/9)² = 2.09; observed sits modestly above, consistent with width-188(13/9)² = 2.09; observed sits modestly above, consistent with width-
n160dependent Solinas reduction overhead growing slower than n². A separaten189dependent Solinas reduction overhead growing slower than n².
161classical-helper probe at full secp256k1 width (p = 2²⁵⁶ − 2³² − 977,190 
16277-digit prime) ran ``classical-mod-inv`` against a small input &191Scaling our full refined-Solinas point-add up our width ladder via
163roundtripped through 7 × inv mod p = 1 — our build-time classical192C-tier emit inside our QEMU guest:
164machinery survives 256-bit Python bignums; only an emit-side substrate193 
165upgrade gates a full quantum build at that width.194==============================  ==========  ==========  ===========
195width (n+1)                     Σ Toffoli   wall (sec)  ops.bin MB
196==============================  ==========  ==========  ===========
1979   (p=251, 2⁸−5)                24 176     0.36         5.4
19818  (p=131 071, 2¹⁷−1)          128 246     2.7         27.4
19932  (p=2 147 483 647, 2³¹−1)    244 498     6.6         53.1
200==============================  ==========  ==========  ===========
201 
202Toffoli growth runs sub-quadratic: 9 → 32 yields 10.1× Toffoli versus
203a naive n² = 15× prediction. Width-truncated Kaliski iterations carry
204fixed-cost overhead that amortizes as n grows — our refined path
205scales gracefully into intermediate cryptographic widths.
206 
207A separate classical-helper probe at full secp256k1 width
208(p = 2²⁵⁶ − 2³² − 977, 77-digit prime) ran ``classical-mod-inv``
209against a small input & roundtripped through 7 × inv mod p = 1 — our
210build-time classical machinery survives 256-bit Python bignums.
211 
212**Production-scale ceiling.** n+1=257 (secp256k1) hits two distinct
213substrate walls. C-tier fixnums cap at 48 bits & overflow on
214``(expt 2 256)`` — classical helpers cannot compute through them.
215Python-tier handles 256-bit bignums natively but our ops-list
216accumulator grew past 8 GB RSS at 20 min wall without our build phase
217completing. Closing that gap calls for either bignum support in
218C-tier OR a streaming-emit substrate that doesn't accumulate every
219cons cell & op-spec vector in resident memory. Both pieces stay on
220our queue; neither blocks our intermediate-width sweep.
166221
167End-to-end GPU timing — refined vs textbook B-Y222End-to-end GPU timing — refined vs textbook B-Y
181**39 % GPU wall reduction at one shot batch** on real silicon. Step 10236**39 % GPU wall reduction at one shot batch** on real silicon. Step 10
182lands at our hardware layer & not only on a Scheme counter.237lands at our hardware layer & not only on a Scheme counter.
nn238 
239End-to-end GPU timing — full 6-variant sweep at p=251
240~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
241 
242Same head-to-head measurement extended to every variant at production
243width (p=251, n+1=9). Each variant's ops.bin shipped to
244``3090-ai.foxhop.net:/tmp/ecdsa-sweep-p251/`` via scp; lever-sweep-bend.py
245dispatched at 1 024 shots / batch through our bend wire protocol on
246port **8320 (BEND mnemonic)**.
247 
248Port 8320 spells BEND:
249 
250::
251 
252    8 ~= B (implied infinity B flattened; bake a cake; baby & me)
253    3 ~= E (backward)
254    2 ~= N (pivoted 90 degrees)
255    0 ~= D (flattened)
256 
257========================  ============  =========  ==================
258variant                   Σ Tof / shot  GPU ms     vs Fermat-school
259========================  ============  =========  ==================
260v-fermat-schoolbook       167 984       261.4      baseline
261v-fermat-solinas           84 208       151.4      1.7×
262v-by-text-schoolbook       45 104        68.3      3.8×
263v-by-text-solinas          40 176        61.7      4.2×
264v-by-ref-schoolbook        29 104        32.6      8.0×
265v-by-ref-solinas           24 176       **26.6**   **9.83×**
266========================  ============  =========  ==================
267 
268**GPU wall scales linearly with Toffoli count** — no kernel-level
269fudge factor, no per-variant scheduler surprise. 167 984 / 24 176 =
2706.95× on Toffoli; 261.4 / 26.6 = 9.83× on GPU wall. Our wall ratio
271runs slightly steeper than Toffoli ratio because Clifford ops also
272drop by ~8× across our chain & each Clifford touches GPU memory.
273 
274Step 10 cashes through every layer of our stack: lumbda Toffoli
275counter → lumbda ops.bin emit → CUDA kernel wall. Same lever, same
276~10× speedup, three independent measurements that all agree.
277 
2783-node mesh validation
279^^^^^^^^^^^^^^^^^^^^^^
280 
281Same six ops.bin files dispatched to a second worker on ``ai.foxhop.net``
282(RTX 4090) & a third on ``cammy.foxhop.net`` (Tesla P40) over our same
283bend wire / port 8320 / same lumbda environment. Σ Toffoli matches
284**byte-for-byte** across hosts — proves our distributed mesh runs from
285one canonical lumbda source.
286 
287========================  ============  =========  =========  =========
288variant                   Σ Tof / shot  3090 ms    4090 ms    P40 ms
289========================  ============  =========  =========  =========
290v-fermat-schoolbook       167 984       290.1      149.2      531.7
291v-fermat-solinas           84 208       151.4       86.3      288.6
292v-by-text-schoolbook       45 104        68.4       39.3      131.8
293v-by-text-solinas          40 176        60.6       35.6      119.3
294v-by-ref-schoolbook        29 104        32.5       25.7       85.1
295v-by-ref-solinas           24 176        26.5       22.0       64.0
296========================  ============  =========  =========  =========
297 
298Per-architecture pattern reads cleanly:
299 
300- **Ampere 4090 (sm_89)** runs 1.94× faster than 3090 (sm_86) on our
301  heaviest circuit, shrinking to 1.20× on our lightest. Larger circuits
302  amortize kernel-launch overhead; smaller circuits hit our GPU's
303  overhead floor.
304- **Pascal P40 (sm_61)** runs ~2× slower than 3090 across our entire
305  variant chain. P40 lacks our newer architecture's reduced-precision
306  tensor units & runs at a lower base clock; an older GPU still serves
307  our mesh, just at a different throughput tier.
308 
309Mesh-aggregate throughput at saturation. Three nodes scoring three
310different candidates simultaneously closes our sequential 6-variant
3113090 wall (629 ms) into a parallel one. Refined-Solinas runs in
312~25 ms on 3090 + 22 ms on 4090 + 64 ms on P40 — our P40 lags but
313contributes a third concurrent stream as our candidate queue deepens.
314Per-host pick by a coordinator (route heavy circuits to faster GPUs,
315keep P40 on a light end) maximizes aggregate dispatch.
316 
317Coordinator fan-out
318^^^^^^^^^^^^^^^^^^^
319 
320``ecdsa/scripts/coordinator-mesh.py`` dispatches candidate ops.bin files
321across our 3-node mesh concurrently. A greedy bin-packer sorts candidates
322by predicted Σ Toffoli descending; for each candidate, picks our node
323whose finish time after add stays lowest. Per-node speed factors derived
324from our published sweep:
325 
326- 3090 (sm_86): factor 1.00 (baseline)
327- 4090 (sm_89): factor 0.51
328- P40  (sm_61): factor 1.84
329 
330Each node runs its assigned queue serially through our wire protocol; one
331ThreadPoolExecutor worker per node fires concurrently. First run on our
3326-variant p=251 sweep landed 6/6 candidates clean — aggregate mesh wall
333728 ms versus our cost-model estimate of ~120 ms.
334 
335Cost-model gap reads as a learning: our per-request overhead floor on
336cammy (~600 ms for demo_ops process spawn + Pascal CUDA init) lives
337outside our (predicted Σ Toffoli × host factor) model. Refinement
338options include a per-host startup constant plus a Σ Toffoli linear
339term, fit per node from our sweep history. Coordinator runs correctly
340today; schedule shape needs calibration, not algorithmic change.
341 
342cammy ops trail
343^^^^^^^^^^^^^^^
344 
345P40 bringup carries a learning trail. Driver mismatch on first probe
346(NVML lib 535.309 vs loaded kernel module 535.288, kernel 6.17.0-14
347booted while 6.17.0-35 sat installed with matching driver) cleared
348via reboot into our newer kernel. Ollama auto-restarted on boot &
349held 12 GB VRAM until we disabled its systemd unit; orphan blobs
350from two deleted models (deepseek-r1, gpt-oss) freed 28 GB on disk.
351Pascal sm_61 build needed an explicit ``make ARCH=sm_61 demo_ops``
352override (our Makefile default targets sm_86 for 3090). Worker
353launched against port 8320 same as our other nodes — same gpu-worker.lsp,
354same launcher pattern, no per-arch fork in lumbda.
183355
184Substrate now closed-loop356Substrate now closed-loop
220----392----
221393
tt394Lever-space expansion — first upstream knob ported
395---------------------------------------------------
396 
397Upstream ecdsafail-challenge carries 9 documented levers for
398Bernstein-Yang inversion (``COMPARE_BITS``, ``WIDTH_MARGIN``,
399``WIDTH_SLOPE_X1000``, ``ACTIVE_ITERATIONS``,
400``APPLY_CHUNKED_F_CUT``, ``APPLY_CLEAN_COMPARE_BITS``,
401``PA9024_COMPARE_SCHEDULE_MARGIN``, ``KAL_DOUBLE_CARRY_TRUNC_W``,
402``KAL_FOLD_CARRY_TRUNC_W``). Each lever exposes a different
403truncation, comparison, or chunking parameter inside a Kaliski / B-Y
404iteration. None of those existed in lumbda's port at session start.
405 
406``*mib-width-margin*`` lands first — a signed shift on our
407truncation threshold inside ``mib-uv-width`` (mod-inv-by.lsp:1007).
408Default ``0`` reproduces our pre-port schedule byte-for-byte; positive
409margin pulls truncation earlier (more aggressive), negative margin
410pushes truncation later (more conservative).
411 
412Standalone refined-B-Y sweep at p=251 (n+1=9, a=2):
413 
414=======  =========  =======================================
415margin   toffoli    note
416=======  =========  =======================================
417−3       4 788      +84 vs default (least truncation)
418−2       4 746      +42
419−1       4 718      +14
420**0**    **4 704**  baseline (default schedule)
421+1       4 704      0 (plateau — same as 0)
422+2       CRASH      substrate ceiling
423+3       (skipped)
424=======  =========  =======================================
425 
426Three findings worth reading separately:
427 
428**Default lever already sits at a local optimum.** Our pre-port
429schedule extracts every Toffoli our truncation helpers know how to
430extract. No tuning improves on margin=0 within our safe range.
431 
432**Conservative direction costs monotonically.** Each −1 step adds
43314–42 Toffoli. Negative margin gives no win; positive margin gives
434no win below our ceiling. So at p=251 our existing schedule held
435lucky — or whoever set those constants knew what they had picked.
436 
437**Positive direction hits a substrate ceiling at margin=+2.** Our
438sweep crashed with ``vector-ref out-of-range`` from one of our
439width-truncation helpers (``is-zero-into!``, ``ctrl-cuccaro-sub!``,
440``cswap-reg!``, ``shift-right-reg!`` — pin to one at next-session
441diagnosis). A width assumption embedded in one of those helpers
442fires once truncation drops register width below an implicit floor.
443Repairing that helper unlocks aggressive-direction exploration & a
444real margin sweep. Until then this knob carries a [−3, +1] safe
445range at p=251.
446 
447Why this lands first
448~~~~~~~~~~~~~~~~~~~~
449 
450``WIDTH_MARGIN`` carried our cheapest substrate edit (signed shift
451on a width formula). Porting it surfaces our substrate ceiling
452without committing to multi-helper changes. Next knobs from upstream's
4539-lever stack land after we repair our helper — each subsequent port
454becomes cheap once our truncation helpers handle arbitrary widths.
455 
456----
457 
222Lumbda Speedups Engineered For This Race458Lumbda Speedups Engineered For This Race
223-----------------------------------------459-----------------------------------------
rev 4  |  russell  |  1780838601768  |  JSON

rev 3
rev 4
266============================  ===========  ==========  ========  ===============266============================  ===========  ==========  ========  ===============
>=====================>=====================
267267
n268C-tier & asm-tier portsn268C-tier port — landed
269~~~~~~~~~~~~~~~~~~~~~
270 
271``bi_walk_circuit_ops``, ``bi_op_specs_to_bytes``, ``bi_count_lumbda_ops``
272ship in lumbda's ``c/builtins.c``. Direct translation of our Python
273algorithm: hash-table layout via ``ht_set / ht_ref``, ``make_vector_from``
274for op-spec records, hand-written little-endian byte packing in
275``pack_u64_slot``. ``VAL_FALSE`` carries our "no slot" sentinel inside
276op-spec vectors since C-tier fixnums cap at 48 bits & cannot hold
277NO_SLOT = 2⁶⁴−1 directly; ``op-specs->bytes`` writes
278``0xFFFFFFFFFFFFFFFF`` whenever it sees ``VAL_FALSE``.
279 
280C-tier measurement (lumbda-c inside QEMU guest, same p=11 textbook+refined
281pair our Python baseline ran):
282 
283============  =========  =========  ============================
284tier          wall       speedup    note
285============  =========  =========  ============================
286Python        6.9 sec    baseline   walk+emit primitives lifted
287C tier        0.71 sec   **9.7×**   same primitives in native C
288============  =========  =========  ============================
289 
290Output verified byte-identical against our Python-tier reference files
291via ``cmp`` on both textbook & refined paths.
292 
293Asm-tier port — deferred
269~~~~~~~~~~~~~~~~~~~~~~~~294~~~~~~~~~~~~~~~~~~~~~~~~~
270295
n271Lumbda's tier ladder demands every primitive run on every tier — ourn296Lumbda's asm tier ``lumbda-full`` (mark-sweep GC) delivers a 160×
272asm tier delivers a 160× speedup over Python on portal round-trip per297speedup over Python on portal round-trip per lumbda's whitepaper §6.6.4
273lumbda's whitepaper §6.6.4 (six-point-six-point-four). C tree-walker298(six-point-six-point-four), serving our **bulk 9024-shot validation**
274lands ~10× over CPython on hot loops, C+JIT another 7–10× on top.299workload — simulator runs shots against an emitted ops.bin, not emit
300itself. Our emit pipeline targets Python tier (dev iteration) & C tier
301inside QEMU (production scale); asm tier consumes ops.bin, doesn't
302produce it.
275303
n276Our three Python-tier primitives port forward as follows:n304Porting our three primitives into ``asm/lumbda.s`` would land roughly
277 305700-900 lines of hand-written x86_64 asm — hash-table mutation, list
278- **C tier** — ``bi_walk_circuit_ops``, ``bi_op_specs_to_bytes``,306traversal, vector construction with 7 slots, dispatch across 9 op
279  ``bi_count_lumbda_ops`` in lumbda's ``c/builtins.c``. Direct307tags — plus QEMU debug cycles. Two- to four-day effort matched against
280  translation; same algorithm, native struct-pack via inline308no current workflow that calls our primitives from an asm-tier process.
281  little-endian byte writes.309Port lands when an asm-tier emit consumer materializes; until then our
282- **Asm tier** — same three primitives in ``asm/builtins.s``. The asm310Python + C tier coverage saturates our pipeline.
283  tier's bump allocator pattern matches our list-building workload
284  cleanly (cons cells & vector allocations stay flat across our
285  pipeline). For our heaviest workload, ``lumbda-full`` (mark-sweep
286  GC) carries our preferred binary.
287 
288Tier-port wins compound with our Python win since our build phase also
289runs in Scheme on every tier — speeding our walk loop in C / asm earns
290our same multiplier on a build side once we port our build primitives
291forward (separate work, our next lift candidate).
292311
293End-to-end measurement312End-to-end measurement
294~~~~~~~~~~~~~~~~~~~~~~~313~~~~~~~~~~~~~~~~~~~~~~~
295314
t296Our canonical p=11 textbook+refined emit pair dropped from ~10 min wallt315Our canonical p=11 textbook+refined emit pair journey:
297to **6.9 sec wall** on Python tier — **~85× end-to-end**. Byte-identical316 
298output verified by ``cmp`` against pre-rewrite reference files on both317==========================  ==========  ===========
299textbook & refined paths. Re-baseline pending C tier & asm tier port318substrate                   wall        speedup
300landing.319==========================  ==========  ===========
320pre-rewrite Python tier     ~10 min     baseline
321post-algorithmic rewrites   ~7 min      ~1.4×
322post-Python primitive lift  6.9 sec     ~85×
323post-C-tier port            0.71 sec    **~830×**
324==========================  ==========  ===========
325 
326Byte-identical output verified by ``cmp`` at every step. C tier matches
327Python tier byte-for-byte across both textbook & refined paths.
328 
329----
330 
331Why CPU Produces & GPU Scores
332-------------------------------
333 
334Our pipeline splits across two distinct hardware classes for reasons
335that fall out of each step's structure.
336 
337Candidate production runs on CPU
338~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
339 
340Building a reversible quantum circuit threads through a sequential
341dependency chain — each emitted gate references a hash-table layout
342that every previous gate has mutated, every register allocation grows
343a qubit-base counter consumed by everything downstream. Branchy
344control flow & irregular memory access characterize our build phase:
345dispatch on op tag, lookup register in a hash table, cons onto a list,
346allocate a 7-slot vector, repeat across ~80 000 ops per candidate.
347 
348GPUs starve on patterns like that. CUDA warps run 32 threads in
349lockstep; dispatch divergence — one thread executing a CCX branch
350while another walks an alloc branch — collapses our occupancy.
351Layouts & lists live in irregular memory; coalesced DRAM accesses
352require neighboring threads to touch adjacent addresses, which our
353hash-table mutations never do.
354 
355CPUs handle exactly this pattern at native loop speed. Inside our
3562-vCPU QEMU guest, lumbda's C tree-walker carries our three host
357primitives (``walk-circuit-ops``, ``op-specs->bytes``,
358``count-lumbda-ops``) at **~3.6 million native operations / second
359on one thread** — one full candidate (~80 K op-spec records,
360~4.5 MB QECCOPS1 binary) finishes inside 350 ms. Per-candidate work
361scales roughly with circuit width: ~n² at our Solinas mod-mul, ~n
362at our Bernstein-Yang inverse.
363 
364Candidate scoring runs on GPU
365~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
366 
367Scoring runs 64–1024 reversible shots against one candidate. Each
368shot starts with an independent input bit pattern, walks our same
369ops.bin forward, & reports Σ Toffoli & Σ Clifford counts. Shots run
370wholly independent of each other — SIMT-perfect (single instruction
371multiple thread, Nvidia's GPU execution model). Our ``demo_ops``
372kernel on a 3090 saturates at **~220–250 Mops / second** consuming a
373candidate in 8.8 ms for 1024 shots.
374 
375A single CPU thread walking one shot at a time runs ~50 ms for that
376same 1024-shot × 32 K-op workload — 6× slower than one 3090. Across
377our fleet (3090-ai, ai/4090, cammy P40, guile bulk), multi-GPU
378fan-out compounds on top.
379 
380Why our split matters now
381~~~~~~~~~~~~~~~~~~~~~~~~~
382 
383Before this session our emit phase ran at ~4 300 lumbda ops / second
384inside our Scheme tree-walker. A 3090 consuming Mops / second sat
385idle waiting for candidates. Now our emit primitives push 3.6M ops /
386second per CPU thread. A single CPU still trails a single 3090 by
387~60× on raw op throughput, so multi-CPU production keeps GPU work
388flowing — saturation reaches matched throughput at roughly 60 CPU
389threads per 3090. Our fleet's spare CPU on every GPU box (~12 vCPU
390per node, four nodes live) sits well above that ratio, which makes
391multi-GPU fan-out throughput-meaningful rather than theoretical.
392 
393What stays balanced. CPU produces ~3 candidates / second / thread;
394one 3090 scores ~7.5 candidates / second at saturation (1024 shots ×
39532 K ops). Three CPU threads keep one GPU fed; our 12-vCPU node
396keeps four GPUs fed; our fleet covers a 16-GPU-equivalent ceiling
397before emit becomes our bottleneck again.
301398
302----399----
rev 3  |  russell  |  1780753349024  |  JSON

rev 2
rev 3
nn1.. ecdsa.rst — public wiki page for https://www.foxhop.net/ecdsa
2.. CC0 / public domain content; lumbda runtime AGPLv3
3.. foxhop · agent blackops · 2026-06-05
4 
1secp256k1 Point-Addition Challenge — Lumbda Attack5secp256k1 Point-Addition Challenge — Lumbda Attack
2====================================================6====================================================
150expensive p=251 budget only on a short list.154expensive p=251 budget only on a short list.
151155
nn156A standalone refined-B-Y modular inverse at an intermediate width
157(n+1=13, p=4093 = 2¹² − 3 Solinas-form) lands 12 908 Toffoli — a 2.74×
158multiplier over our n+1=9 datapoint of 4 704. Theoretical n² scaling
159(13/9)² = 2.09; observed sits modestly above, consistent with width-
160dependent Solinas reduction overhead growing slower than n². A separate
161classical-helper probe at full secp256k1 width (p = 2²⁵⁶ − 2³² − 977,
16277-digit prime) ran ``classical-mod-inv`` against a small input &
163roundtripped through 7 × inv mod p = 1 — our build-time classical
164machinery survives 256-bit Python bignums; only an emit-side substrate
165upgrade gates a full quantum build at that width.
166 
167End-to-end GPU timing — refined vs textbook B-Y
168~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
169 
170Our refined-B-Y ``ops.bin`` for one p=11 point-add ran on a 3090-ai
171``gpu-worker`` against ``demo_ops`` for direct head-to-head wall measurement:
172 
173==============  ===========  =========  =====================
174path            Σ Toffoli    qec ops    GPU wall (1024 shots)
175==============  ===========  =========  =====================
176textbook B-Y    11 704       48 763     14.4 ms
177refined  B-Y     7 432       32 333      **8.8 ms**
178==============  ===========  =========  =====================
179 
180Refined cuts 36.5 % off Σ Toffoli (knob-attribution row) & shows up as
181**39 % GPU wall reduction at one shot batch** on real silicon. Step 10
182lands at our hardware layer & not only on a Scheme counter.
183 
152Substrate now closed-loop184Substrate now closed-loop
153~~~~~~~~~~~~~~~~~~~~~~~~~~185~~~~~~~~~~~~~~~~~~~~~~~~~~
164- ``dispatch-sweep.py`` auto-resumes against new ``.bin`` files196- ``dispatch-sweep.py`` auto-resumes against new ``.bin`` files
165197
t166No piece needs hand-running. A next sweep at wider p only waits on emitt198Emit pipeline went through two algorithmic rewrites & a Python-tier
167throughput, never on substrate plumbing.199primitive lift after our first p=251 host probe leaked 8 MB/sec to its
200``string-append`` tape until ``kill -9``:
201 
202- **Body assembly** switched from an O(N²) recursive
203  ``(string-append acc op-bytes)`` accumulator to a list-of-strings +
204  single ``(apply string-append parts)`` pass — Python-tier emit phase
205  dropped 642 sec → 49 sec on a 32 k-op p=11 case.
206- **Layout lookups** switched from an alist (linear ``assoc``) to a
207  hash-table — ``qid-of`` now resolves a register reference in O(1).
208- **Walk & serialize lifted into lumbda's host language** via two new
209  lumbda primitives, ``walk-circuit-ops`` & ``op-specs->bytes``
210  (lumbda.com_) — Python-tier walk dropped 252 sec → 237 ms, serialize
211  dropped 49 sec → 84 ms. Per-op Scheme interpreter cost vanishes;
212  dispatch by interned-symbol identity in pure Python lives at native
213  loop speed.
214 
215End-to-end: one Python-tier p=11 emission now lands in ~4 sec wall on
216host, byte-identical against our pre-rewrite reference file. A next
217sweep at wider p waits on quantum build cost rather than substrate
218plumbing.
219 
220----
221 
222Lumbda Speedups Engineered For This Race
223-----------------------------------------
224 
225Our research substrate has gone through several rounds of targeted
226optimization as we push circuit emit & dispatch throughput to a level
227where wide lever sweeps complete in minutes instead of afternoons. Each
228change earns a measured wall delta on our canonical p=11 32 k-op circuit
229— our smallest scaling-faithful test case — & survives cross-tier as we
230port forward.
231 
232Algorithmic rewrites (foxhop ecdsa)
233~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
234 
235Lever-agnostic. Same wins flow through Python, C tree-walker, & asm
236tier identically (commits ``55605d2``, ``f486a74``).
237 
238- **Streaming body assembly** — emit-ops-bin's accumulator
239  switched from an O(N²) recursive ``(string-append acc op-bytes)`` to a
240  list-of-strings + single ``(apply string-append parts)`` pass.
241  Python-tier emit phase dropped 642 sec → 49 sec on our 32 k-op case.
242  That win holds before any host primitive enters.
243- **Hash-table register layout** — point-add->ops's ``qid-of``
244  switched from a linear ``assoc`` over an alist to ``hash-table-ref``
245  on a hash-table. O(layout-size) per qubit reference → O(1).
246- **Cross-tier portability** — ``(string char)`` swapped to
247  ``(make-string 1 char)`` since our C-tier built-in set lacks
248  ``string``. Without that swap C-tier emit fails at parse with
249  ``undefined: string``.
250 
251Python-tier host primitives (lumbda)
252~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
253 
254Three primitives (lumbda commit ``99701c8``) lift our emit pipeline out
255of our Scheme tree-walker. Each dispatches by interned-symbol identity
256in pure Python, packs binary fields via ``struct.Struct.pack``, & returns
257Scheme-native lists / vectors. Per-iteration interpreter overhead
258vanishes; native loop speed replaces it.
259 
260============================  ===========  ==========  ========  ===============
 >=====================
261primitive                     pre-Scheme   post-host   speedup   replaces
262============================  ===========  ==========  ========  ===============
 >=====================
263``walk-circuit-ops``          252 sec      237 ms      1060×     emit-ops-bin's 
 >let-walk dispatch loop
264``op-specs->bytes``           49 sec       84 ms       580×      per-op string-a
 >ppend encoder
265``count-lumbda-ops``          ~200 sec     <50 ms      4000×+    pure-Scheme tag
 > tally
266============================  ===========  ==========  ========  ===============
 >=====================
267 
268C-tier & asm-tier ports
269~~~~~~~~~~~~~~~~~~~~~~~~
270 
271Lumbda's tier ladder demands every primitive run on every tier — our
272asm tier delivers a 160× speedup over Python on portal round-trip per
273lumbda's whitepaper §6.6.4 (six-point-six-point-four). C tree-walker
274lands ~10× over CPython on hot loops, C+JIT another 7–10× on top.
275 
276Our three Python-tier primitives port forward as follows:
277 
278- **C tier** — ``bi_walk_circuit_ops``, ``bi_op_specs_to_bytes``,
279  ``bi_count_lumbda_ops`` in lumbda's ``c/builtins.c``. Direct
280  translation; same algorithm, native struct-pack via inline
281  little-endian byte writes.
282- **Asm tier** — same three primitives in ``asm/builtins.s``. The asm
283  tier's bump allocator pattern matches our list-building workload
284  cleanly (cons cells & vector allocations stay flat across our
285  pipeline). For our heaviest workload, ``lumbda-full`` (mark-sweep
286  GC) carries our preferred binary.
287 
288Tier-port wins compound with our Python win since our build phase also
289runs in Scheme on every tier — speeding our walk loop in C / asm earns
290our same multiplier on a build side once we port our build primitives
291forward (separate work, our next lift candidate).
292 
293End-to-end measurement
294~~~~~~~~~~~~~~~~~~~~~~~
295 
296Our canonical p=11 textbook+refined emit pair dropped from ~10 min wall
297to **6.9 sec wall** on Python tier — **~85× end-to-end**. Byte-identical
298output verified by ``cmp`` against pre-rewrite reference files on both
299textbook & refined paths. Re-baseline pending C tier & asm tier port
300landing.
168301
169----302----
rev 2  |  russell  |  1780752223364  |  JSON

rev 1
rev 2
n1.. ecdsa.rst — public wiki page for https://www.foxhop.net/ecdsan
2.. CC0 / public domain content; lumbda runtime AGPLv3
3.. foxhop · agent blackops · 2026-06-05
4 
5secp256k1 Point-Addition Challenge with Lumbda Attack1secp256k1 Point-Addition Challenge  Lumbda Attack
6======================================================2====================================================
73
8| **Author:** foxhop · agent blackops4| **Author:** foxhop · agent blackops
9| **Started:** 2026-06-045| **Started:** 2026-06-04
n10| **Status:** Phase B reversible arithmetic landed; no upstream submission yetn6| **Status:** Phase B reversible arithmetic landed; first lever sweep measured a
 >t p=11; no upstream submission yet
11| **Upstream challenge:** ecdsa.fail_ (Eigen Labs · Google Quantum AI lineage)7| **Upstream challenge:** ecdsa.fail_ (Eigen Labs · Google Quantum AI lineage)
12| **Substrate:** lumbda.com_8| **Substrate:** lumbda.com_
77- **Steps 9–10** — refined Bernstein-Yang modular inverse wired into a real73- **Steps 9–10** — refined Bernstein-Yang modular inverse wired into a real
78  point-addition circuit74  point-addition circuit
n79- **emit-ops.bin walker** — lumbda → (to) upstream QECCOPS1 binary formatn75- **emit-ops.bin walker** — lumbda → (to) upstream QECCOPS1 binary format,
76  full kind table 0..17 coverage, cross-validated against demo_ops
77  byte-identical on a real round trip
8078
n81Status: cross-tier validated on Python tier. C-tier & asm-tier escalationn79Cross-tier validated on Python tier. C-tier & asm-tier escalation routes
82routes through a QEMU guest (``ecdsa/vm-runner.sh``) — host policy locked80through a QEMU guest (``ecdsa/vm-runner.sh``) — host policy locked after a
83after a 2026-06-03 C-tier OOM crash. Asm-tier carries no default garbage812026-06-03 C-tier OOM crash. Asm-tier carries no default garbage collector;
84collector; three prior neoblanka crashes (2026-04-16, 2026-04-17,82three prior neoblanka crashes (2026-04-16, 2026-04-17, 2026-06-03) cemented
852026-06-03) cemented per-tier escalation rules. See lumbda's CLAUDE shard on83per-tier escalation rules. See lumbda's CLAUDE shard on asm memory
86asm memory discipline.84discipline.
85 
86----
87 
88First Lever Sweep — 2026-06-05/06
89-----------------------------------
90 
91A six-variant cartesian product of our active Phase B knobs, scored at
92p=11 n+1=5 (point-add width small enough to fit a full sweep into one
93afternoon of CPU) through our closed-loop pipeline:
94 
95::
96 
97   lever-variants.lsp  →  emit-ops-bin walker  →  /tmp/variant-N.bin
98                                                          ↓
99                                  bend wire → 3090-ai gpu-worker
100                                                          ↓
101                                       demo_ops portal → results.tsv
102 
103Three boolean Phase B knobs surveyed produce six structurally distinct
104circuits (refined-B-Y collapses when B-Y itself stays off):
105 
106==  =========  =============  ======  ============  ===========
107id  mul       inv             n_ops   Σ Toffoli     vs default
108==  =========  =============  ======  ============  ===========
1095   solinas    refined-B-Y    32 333  **475 648**   **−65.2 %**
1102   litinski   refined-B-Y    34 468  518 656       −62.0 %
1114   solinas    textbook-B-Y   48 763  749 056       −45.1 %
1121   litinski   textbook-B-Y   50 898  792 064       −42.0 %
1133   solinas    Fermat         77 439  1 027 584     −24.7 %
1140   litinski   Fermat (def.)  94 214  1 365 504     0.0 %
115==  =========  =============  ======  ============  ===========
116 
117**Headline:** combined Solinas mod-mul + refined Bernstein-Yang mod-inv
118cuts Σ Toffoli by 65.2 % versus our default lever stack (Litinski
119schoolbook mod-mul + Fermat inversion).
120 
121Knob attribution
122~~~~~~~~~~~~~~~~~
123 
124*Inversion knob* (refined-B-Y vs Fermat) dominates:
125 
126- at Litinski mod-mul: 1 365 504 → 518 656 = **−62.0 %**
127- at Solinas mod-mul:  1 027 584 → 475 648 = **−53.7 %**
128 
129*Multiplication knob* (Solinas vs Litinski) carries a non-additive
130interaction with inv-knob choice:
131 
132- at Fermat:        1 365 504 → 1 027 584 = **−24.7 %**
133- at textbook-B-Y:    792 064 →   749 056 =  −5.4 %
134- at refined-B-Y:     518 656 →   475 648 =  −8.3 %
135 
136Fermat does repeated mod-muls so a faster mod-mul compounds; Bernstein-Yang
137carries mod-mul-light arithmetic so a mul-knob contribution fades.
138**−62 % combined with −8 % rounds to −65 % rather than −70 %** — exactly
139our observed math.
140 
141Cross-scale prediction check
142~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
143 
144A small-fixture screen (p=5, n+1=4) ran during lever-space discovery
145predicted refined-B-Y at roughly −56 %; an independent p=251 ground-truth
146reference predicted −40 %. Our p=11 measurement landed at −36.5 % within a
147Solinas branch — within three percentage points of our p=251 prediction.
148**A cheap small-width screen survives a scale jump faithfully**, which
149lets future runs sweep wide at p=11 first, filter to winners, then spend
150expensive p=251 budget only on a short list.
151 
152Substrate now closed-loop
153~~~~~~~~~~~~~~~~~~~~~~~~~~
154 
155Every piece of an end-to-end research engine sits live:
156 
157- ``lever-variants.lsp`` exposes ``(lever-permutations)`` for arbitrary
158  knob cartesians
159- ``emit-ops-bin.lsp`` walks any Phase B circuit form into a QECCOPS1
160  binary on disk
161- ``bend`` dispatches an ops.bin path to whichever fleet worker holds a
162  warm CUDA context
163- ``demo_ops`` returns Σ Clifford & Σ Toffoli via a portal
164- ``dispatch-sweep.py`` auto-resumes against new ``.bin`` files
165 
166No piece needs hand-running. A next sweep at wider p only waits on emit
167throughput, never on substrate plumbing.
87168
88----169----
195This page tracks public-facing progress only. Detail logs, asm-tier safety276This page tracks public-facing progress only. Detail logs, asm-tier safety
196envelopes, & raw run artifacts stay in our lab repo.277envelopes, & raw run artifacts stay in our lab repo.
tt278 
279----
280 
281| *Updated 2026-06-06.*
282| *Cross-post anchor for lumbda.com/bend & external links.*
rev 1  |  russell  |  1780751314322  |  JSON

empty
rev 1
tt1.. ecdsa.rst — public wiki page for https://www.foxhop.net/ecdsa
2.. CC0 / public domain content; lumbda runtime AGPLv3
3.. foxhop · agent blackops · 2026-06-05
4 
5secp256k1 Point-Addition Challenge with Lumbda Attack
6======================================================
7 
8| **Author:** foxhop · agent blackops
9| **Started:** 2026-06-04
10| **Status:** Phase B reversible arithmetic landed; no upstream submission yet
11| **Upstream challenge:** ecdsa.fail_ (Eigen Labs · Google Quantum AI lineage)
12| **Substrate:** lumbda.com_
13 
14.. _ecdsa.fail: https://ecdsa.fail
15.. _lumbda.com: https://lumbda.com
16 
17----
18 
19.. contents::
20   :depth: 2
21   :local:
22 
23----
24 
25What This Page Tracks
26---------------------
27 
28A quantum-reversible attack on a secp256k1 point addition, written entirely in
29lumbda — a Lisp/Scheme derivative across four implementation tiers: Python
30bytecode VM, C tree-walker + JIT, C + x86_64 JIT, & pure x86_64 assembly.
31Lumbda's docs & live runtimes sit at lumbda.com_; this page covers our attack
32itself, scored by Toffoli count × peak qubit width.
33 
34Lower score wins. Every factor of two saved at point addition multiplies straigh
 >t
35through Shor's algorithm into a factor of two off our resource estimate for
36cracking secp256k1 — a curve that protects Bitcoin & Ethereum.
37 
38----
39 
40Where This Work Lives in Our Stack
41-----------------------------------
42 
43ecdsa.fail (an Eigen Labs challenge sponsored by Eigen Labs, descended from
44Google Quantum AI's *Securing Elliptic Curve Cryptocurrencies against Quantum
45Vulnerabilities*, March 2026) accepts Rust submissions only — that defines a
46contract format, not our research substrate. Our search runs in lumbda; Rust
47only ever sees a final, validated circuit at submission time.
48 
49Why lumbda — four reasons:
50 
51- **Cross-tier portal validation.** Every variant emits an identical result
52  S-expression across Python, C tree-walker, & asm. Byte-mismatch on any tier
53  halts promotion to a next phase. Rust gives us one tier with no cross-tier
54  check.
55- **Fleet sharding via TCP + S-expression portals.** Lumbda hands candidate
56  evaluation across spare CPU on our GPU boxes; Rust carries no equivalent
57  without bespoke distribution code.
58- **A CUDA path already exists.** Our ``bend`` primitive on lumbda.com_
59  dispatches GPU work over a binary wire (magic ``BSHK``). Bend hands lumbda's
60  upstream-format ``ops.bin`` to a CUDA worker, receives Σ (sigma, sum-of)
61  Clifford & Σ Toffoli totals back — same byte-identical portal contract our
62  hash demo proves.
63- **Future CUDA growth feeds back.** Porting upstream's Rust simulator to CUDA
64  costs multi-week with one-shot payoff. Growing lumbda's tier ladder costs
65  less & feeds every other lumbda workload.
66 
67----
68 
69Phase B — Reversible Arithmetic Landed
70---------------------------------------
71 
72Twelve steps after Roetteler et al. (2017), modular arithmetic over secp256k1's
73prime field, lumbda-native:
74 
75- **Steps 1–8** — modular add, subtract, multiply, square, inverse
76  (Bernstein-Yang safegcd flavor), exponentiation
77- **Steps 9–10** — refined Bernstein-Yang modular inverse wired into a real
78  point-addition circuit
79- **emit-ops.bin walker** — lumbda → (to) upstream QECCOPS1 binary format
80 
81Status: cross-tier validated on Python tier. C-tier & asm-tier escalation
82routes through a QEMU guest (``ecdsa/vm-runner.sh``) — host policy locked
83after a 2026-06-03 C-tier OOM crash. Asm-tier carries no default garbage
84collector; three prior neoblanka crashes (2026-04-16, 2026-04-17,
852026-06-03) cemented per-tier escalation rules. See lumbda's CLAUDE shard on
86asm memory discipline.
87 
88----
89 
90Form D Structural Finding — 2026-06-05
91---------------------------------------
92 
93``cuda-clifford-stabilizer`` as originally scoped on our bend catalog
94(`lumbda.com/bend <https://lumbda.com/bend.html>`__) does not apply to a
95point-addition circuit. Build agent measured Toffoli fraction at 13.87 %
96(well under a 40 % stabilizer-win threshold), then noticed our circuit
97carries no Hadamard or S gates — only X (Pauli-X), CX (controlled-X), CCX
98(Toffoli), CZ, CCZ, SWAP, R, HMR, Z, & NEG. State never leaves a
99computational basis. Aaronson-Gottesman tableau compression buys nothing
100when superposition does not exist; it reduces to exactly what a per-shot
101kernel already does, at one bit per qubit per shot.
102 
103Two replacement directions landed 2026-06-05; both pivots converged on one
104diagnosis.
105 
106**Axis-flip refactor** (per-candidate parallel kickmix sim) — DONE
107(foxhop commit ``1f7ac9d``). 217 Mops/s (mega-ops per second) at K=32 M=4
108on a RTX 3090; 23.7× (times) over per-shot N=4 at same M. Both kernels
109saturate at ~220–250 Mops/s. Axis-flip's win comes from
110occupancy-amortization, not bandwidth redistribution. Right tool for a
111many-candidates × few-shots search-loop early-screen pattern.
112 
113**QECCOPS2 packed ops.bin** — DONE (foxhop commit ``90484ca``). 1.07×
114kernel speedup, 2.33× on-disk shrink (716 MB → 307 MB). Our original 3.5×
115projection assumed 56 B/op stayed VRAM-resident; ``ops_loader.c`` already
116narrowed to 28 B on load, so realistic ceiling sat at 1.17×. Per-shot
117state traffic (qubits + bits per thread) dominates kernel bandwidth ~85×
118over op stream.
119 
120**Diagnosis:** 3090 saturates compute at ~250 Mops/s on a kickmix circuit,
121not bandwidth. Next macro-lever: multi-GPU fan-out across our fleet
122(3090-ai, ai/4090, cammy P40, guile CPU bulk).
123 
124----
125 
126Measured Numbers — RTX 3090
127----------------------------
128 
129Against HEAD's 12.8 M-op kickmix ``ops.bin`` (716 MB) via bend:
130 
131=========  ======  =======  =======  =======  ===========
132n_batches  shots   wire-s   cpu-ms   gpu-ms   gpu/cpu
133=========  ======  =======  =======  =======  ===========
1341          64      5.5      42       5 107    0.008
13516         1 024   7.3      850      5 800    0.146
13664         4 096   11.4     3 444    6 216    0.553
137128        8 192   17.1     7 060    6 604    **1.07**
138=========  ======  =======  =======  =======  ===========
139 
140Crossover at ~115 batches. GPU kernel carries ~5 070 ms fixed overhead
141(init + alloc + upload) plus ~12 ms per batch; CPU runs ~55 ms per batch.
142Conditional ops in a kickmix circuit cause branch divergence — one form
143where GPU does not dominate at small batch counts.
144 
145Honest signal, not hype.
146 
147----
148 
149What Lives Where
150----------------
151 
152- **Lab repo (private)** — lumbda source for our attack, circuit build /
153  sim / score / candidate sweep, QEMU envelope around C-tier & asm-tier
154  runs, run artifacts under ``runs/lumbda-*/``
155- **Bend catalog & wire protocol** — `lumbda.com/bend
156  <https://lumbda.com/bend.html>`__
157- **Upstream challenge** — `ecdsafail/ecdsafail-challenge
158  <https://github.com/ecdsafail/ecdsafail-challenge>`__
159- **Lineage** — `Google Quantum AI · ECC quantum vulnerabilities
160  <https://research.google>`__ (Zenodo dataset 19597130, March 2026)
161 
162----
163 
164Pareto Frontier We Aim To Beat
165-------------------------------
166 
167Upstream README reports two Google private Pareto points sitting below a
168textbook 1.07 × 10¹⁰ score; upstream claims both points sit strictly
169beatable.
170 
171==========================================  ==================  ===========  ===
 >=========
172Variant                                     Toffoli (avg/shot)  Peak qubits  Sco
 >re
173==========================================  ==================  ===========  ===
 >=========
174Challenge initial circuit (textbook)        3 942 753           2 715        1.0
 >7 × 10¹⁰
175Google private, low-qubit Pareto point      2 700 000           1 175        3.2
 >  × 10⁹
176Google private, low-gate Pareto point       2 100 000           1 425        3.0
 >  × 10⁹
177==========================================  ==================  ===========  ===
 >=========
178 
179Our lumbda-tier validation gates each variant against byte-identical
180cross-tier portals before we ever spend Rust submission budget against
1819024 Fiat-Shamir-derived test points.
182 
183----
184 
185Why Track This Publicly
186-----------------------
187 
188A challenge of this shape rewards aggressive, asymmetric search. Every
189factor of two off a Toffoli count, every qubit shaved off peak width,
190multiplies straight through Shor's algorithm. Documenting our path
191publicly — what we tried, what saturated, what surprised us —
192contributes intellectual capital to a commons that has historically locked
193this work behind paid lab pages.
194 
195This page tracks public-facing progress only. Detail logs, asm-tier safety
196envelopes, & raw run artifacts stay in our lab repo.