Paper 2025/2220

Performance Improvements of ZK-Prover for rWasm: A Sound and Efficient AIR for 32-bit Division and Remainder

Suleyman Kardas, Batman University
Mehmet Sabir Kiraz, De Montfort University
Dmitry Savonin, Fluent Labs
Yao Wang
Aliaksei Dziadziuk
Abstract

Zero-knowledge virtual machines (zkVMs) must correctly model all edge cases of lowlevel machine instructions, including division and remainder, while keeping algebraic constraints simple enough for efficient STARK proving. This work presents a focused but meaningful redesign of the DivRemChip used in the SP1 zkVM (as adapted to rWasm) to implement WASM’s 32-bit division and remainder instructions (i32.div{u,s}, i32.rem{u,s}) over the BabyBear field. Our chip remains local (single-row AIR) and is purpose-built so that all “small aggregate” expressions are strictly bounded by the BabyBear modulus, allowing us to use inverses securely without ever inverting zero. We replace heavier constant-equality logic and trap gadgets with: (a) a lightweight small-aggregate zero-test for magnitudes that is sound in BabyBear, (b) a simple, byte-level mechanism for detecting the special value INT MIN using only degree-2 constraints, (c) a low-degree test for c = −1 based on checking |c| = 1 together with the sign bit, and (d) a constraint pattern ensuring that divide-by-zero and the overflow case i32.div s(INT MIN,-1) are not provable, matching WASM trap semantics. The resulting AIR has maximal degree 3, removes all “invert-zero” failure modes in BabyBear, and enforces the correct semantics for every non-trapping instruction. A malicious prover test framework based on the SP1 CPU bus shows that any incorrect witness causes constraint failure, while honest execution traces for extensive boundary tests and mixed programs produce valid proofs over BabyBear. Our design also improves efficiency: the trace width drops from 102 to 74 columns, all Mul/Add/Lt/MSB cross-chip calls are removed, and each row requires only a single CPU-bus interaction. Prover benchmarks on unsigned, signed, and mixed workloads with up to 125,000 division/remainder operations show a consistent 4–6% reduction in single-threaded proving time compared to the original SP1 DivRemChip as adapted to rWasm, with a paired t-test across program sizes confirming that the improvement is statistically significant at the 95% confidence level.

Metadata
Available format(s)
PDF
Category
Foundations
Publication info
Preprint.
Keywords
32-Bit Division/RemainderBabyBearWASMzkVM
Contact author(s)
skardas @ gmail com
m kiraz @ gmail com
dmitry @ fluentlabs xyz
nagatoismdrama @ gmail com
djadjka by @ gmail com
History
2026-02-15: last of 3 revisions
2025-12-09: received
See all versions
Short URL
https://ia.cr/2025/2220
License
Creative Commons Attribution
CC BY

BibTeX

@misc{cryptoeprint:2025/2220,
      author = {Suleyman Kardas and Mehmet Sabir Kiraz and Dmitry Savonin and Yao Wang and Aliaksei Dziadziuk},
      title = {Performance Improvements of {ZK}-Prover for {rWasm}: A Sound and Efficient {AIR} for 32-bit Division and Remainder},
      howpublished = {Cryptology {ePrint} Archive, Paper 2025/2220},
      year = {2025},
      url = {https://eprint.iacr.org/2025/2220}
}
Note: In order to protect the privacy of readers, eprint.iacr.org does not use cookies or embedded third party content.