Rust and WebAssembly kernel

On this page
  1. Engines the kernel accepts (17 September)
  2. Run locally
  3. Browser build
  4. Integer bounds
  5. Montgomery multiplication
  6. Measured speed
  7. Evidence and limits

The accelerated kernel implements the same selective mg114-offset-v1 tasks, not a new exhaustive Booker–Sutherland campaign. It keeps task IDs, all logical counters, hit order and SHA-256 receipts identical. Since 17 September the GitHub verifier also replays with this kernel (tools/ingest.py --kernel rust), built from reviewed main source inside the workflow. Python remains the independent reference: every reported identity is re-verified in Python by the bridge, every result is checked for task identity and receipt digest, and a deterministic 1-in-256 share of replayed tasks (selected by task-id hash) is replayed again by the Python engine and must match exactly; any disagreement stops the run as an operational failure. Verified records carry replay_kernel with the Rust and Python source hashes. The Rust core handles enumeration and sieving; the existing Python runner handles worker budgets, seeds, checkpoints, GitHub login and banking.

Engines the kernel accepts (17 September)

Rust and Python agree bit-for-bit on the frozen corpus, on random v2 samples across all 81 contexts, and on cross-target samples (tests/test_native_kernel.py). The same source builds the WebAssembly module, so the browser accepts the same tasks.

Run locally

Install Rust through rustup, plus Python 3.11 or newer. From this repository (or the new runner source archive):

python tools/build_native.py
python tools/runner.py --kernel rust --name "Your alias" --github YOUR_USERNAME --workers 4 --minutes 60 --login --submit

Choose a worker count your machine supports. On Windows use py if python is not available. Each worker keeps a Rust process alive across tasks. Leave out --login --submit to compute without uploading. The default --kernel python remains available without a compiler. Do not share a live checkpoint directory between machines.

Browser build

rustup target add wasm32-unknown-unknown
python tools/build_native.py --wasm
node --test tests/test_wasm_kernel.mjs

The same Rust library compiles to a small WebAssembly module with a capped JSON interface. Each Web Worker owns an instance. Identities are delivered immediately and independently checked with JavaScript BigInt. A failed load falls back to the original BigInt kernel; an arithmetic trap after starting a task is an error, never a completed negative receipt. No SIMD, threads-in-WASM, SharedArrayBuffer or cross-origin isolation is required.

Integer bounds

All public input is validated against the fixed 81 contexts before arithmetic. Bounds below are deliberately conservative, not measured maxima:

Rust release builds retain overflow checks. A bound violation aborts the task; it cannot produce negative coverage. The only intentional wrapping operations are the documented modulo-2^64 Montgomery inverse/reduction operations.

Montgomery multiplication

A separately tested Montgomery path supports odd moduli below 2^63, including composite moduli. Even moduli use ordinary wide multiplication/reduction. The norm root check needs only two modular multiplications per D, so conversion/setup costs can outweigh savings. The benchmark compares both paths; ordinary reduction remains the default rather than assuming Montgomery is automatically faster. The small-prime sieve uses precomputed residue masks, not Montgomery multiplication.

Measured speed

The 567-task matched benchmark measured median 2.340 s in Python and 0.116 s in native Rust (20.2×), and 1.227 s in JavaScript versus 0.237 s in WASM (5.2×, Node on this Mac). All receipts matched. Three warm rounds follow one discarded warmup. Montgomery was slightly slower overall in these measurements, so remains optional. This includes empty and curve-bearing tasks, 79,374 curves and 218 final square tests. Process startup/JSON are included for native; banking, coverage fetches and server verification are not.

Evidence and limits

Run cargo test --manifest-path native/Cargo.toml --locked, then python -m unittest discover -s tests -p test_native_kernel.py and the WASM gate above. Tests include all 243 frozen boundary tasks, 648 seeded random tasks, invalid descriptor rejection, 20,000 Montgomery comparisons, known positive curves, a k=3 identity whose cubes exceed 128 bits, and a complete spawned-runner checkpoint/bank round trip. Fixtures create no public submissions or leaderboard credit.

A language speedup is not a discovery-probability multiplier. The reviewer is right about selective coverage and unvalidated discovery prediction. Their claimed 100–1,000× deficit and “minutes” equivalence require a matched workload: our logical quotient positions include positions rejected without enumeration, and do not measure zcubes sieve instructions. Likewise, a bounded negative receipt proves a negative statement about its exact task, not a new global height bound.

Reference sources: Booker–Sutherland implementation, 64-bit Montgomery arithmetic, and their paper. The published project describes Charity Engine's volunteer PCs; this review did not establish the reviewer's claim of a later GPU implementation.