Advancing Towards ZK Fraud Proof - zkGo: Compiling L2 Geth into ZK-Compatible Wasm
Sun, Jun 2, 2024, 01:21 PM · 27:06
Optimistic rollup suffers from the long settlement delay because of the multi-round interactive dispute game. To accelerate the dispute game, ZK fault proof was recently proposed to challenge a malicious sequencer in a single transaction, significantly reducing gas costs and time compared to traditional fraud proofs. To generate a ZK fault proof, the L2 Geth (a.k.a., op-program-client in Optimism) needs to be emulated in an instruction set architecture (ISA), and then the execution result of the L2 Geth is proven by a zkVM. We choose WebAssembly (Wasm) - a widely adopted open-standard ISA and prove the execution of Wasm code using zkWasm, the state-of-the-art zkVM for Wasm developed by Delphinus Lab. However, there are two main challenges in this path: 1, We cannot directly compile L2 Geth to Wasm with Go due to compilation errors. To solve this problem, inspired by Arbitrum, we make minimum modifications to op-program-client to support Wasm compilation. 2, The compiled Wasm code by Go includes unclean exit code, floating-point instructions, and calls on ill-compatible host functions, which are unfriendly to ZK with high adaption cost. To address this issue, we introduced zkGo - a customized Go compiler to produce Wasm code compatible with ZK prover. As a result of these modifications, the execution of the compiled L2 Geth Wasm code can now be proven using zkWasm.