Formal Verification of Circuit-Soundness in zkWasm, a General Purpose zkVM
Abstract
Recent advances in zero-knowledge (zk) provers make it possible to implement an entire bytecode instruction set so that one can compile and run arbitrary programs and generate zk-proofs of the result. This is a novel kind of programming language implementation. Many blockchain applications are now being re-designed to improve privacy and throughput by verifying zk-proofs rather than running program logic directly. However, zk programming is famously error-prone, and in the blockchain setting, a simple error can lead to hundreds of millions of dollars of cryptocurrency being stolen in an undetectable way. Hence, it is crucial to ensure that a zero-knowledge virtual machine (zkVM) is correct. We prove circuit-soundness for zkWasm, a state-of-the-art zkVM for the WebAssembly language. This is the first mechanized correctness proof of the complete circuits of a general-purpose zkVM, including the memory system. Compared to a conventional interpreter, the way a zkVM represents dynamically sized data structures requires a new set of lemmas. In order to verify the code, we use a hand-translated shallow embedding into Rocq, and this approach is also applicable to other zk-applications written using Halo2 or other PLONKish systems. ZkWasm is a full-scale implementation being used in production systems, not just a prototype, yet only a small kernel needs to be verified, and the proof effort was reasonable. In the process, we uncovered three critical bugs, which illustrate the value of verification in this application domain.
Community
0 commentsNo discussion yet
Be the first to share a question or observation.