# Project proposal: CraneZisk Index document: [CraneZisk index](/1NqZLstgS2KpTASWRgOulg) ## :beginner: Project Info :small_blue_diamond:Project Name: CraneZisk :small_blue_diamond:Team: Andrew Borg in collaboration with Polygon :small_blue_diamond:Expected timeline: October 2024 - February 2025 ## :star: Summary The proposal to build an efficient compiler from Rust to Zisk zkVM based on the [Cranelift toolchain](https://cranelift.dev). ## :triangular_flag_on_post: Background During collaboration between Polygon Hermez and NEAR we've built a [backend for Cranelift compiler](https://github.com/near/wasmtime/blob/main/docs/zkasm/architecture.md) that can compile Rust and WASM programs to [zkEVM and zkASM](https://docs.polygon.technology/zkEVM/spec/zkasm/). This approach showed a lot of promise, being able to generate zkASM for [Keccak hash function](https://github.com/near/wasmtime/blob/ca2f1d0d48045ea3991aa11349e126a8c7aa3480/cranelift/zkasm_data/benchmarks/keccak/src/lib.rs) benchmark with performance within 10x (cycles) of the hand-written state machine. The next leap in performance can come from switching to zkVM that is [better tailored to compilation from Cranelift IR](https://github.com/near/wasmtime/issues/158) (efficient 32-bit operations, efficient access to registers and memory). Zisk is the new zkVM memory-based architecture that would be a great target for Cranelift compilation. ## :spiral_note_pad: Stages and objectives **Problem Formulation: Enable efficient compilation of Rust and WASM programs to Zisk** ### 1. PoC Cranelift-based compiler from Rust to Zisk **Goal:** Build a proof-of-concept Cranelift Zisk backend that can compile multiple representative Rust benchmarks and surpass the performance of RiscV based backend: - Iterative SHA256 - Iterative Keccak - ECDSA verification - Fibonacci numbers Note, that we don't aim to support all possible Rust programs at this point and instead focus on benchmarks only. **Time-estimate:** 2 months of work by Andrew with basic support from Zisk team ### 2. Feature-complete compiler from Rust to Zisk **Goals:** - Extend the PoC Zisk backend to support all relevant Rust programs (e.g. feature parity with SP1) - Onboard engineer(s) from Polygon to co-own of the project **Time-estimate:** 2 months of work by Andrew + 1 collaborator from Polygon ### 3. Production-ready compiler from Rust to Zisk **Goals:** - Compiler easily available to the end-users - High test coverage - Performance regression tests **Time-estimate:** 2 months of work by Andrew + 2 collaborators from Polygon ## :timer_clock: Timeline | **Item** | **Date** | **Note** | |:----------------------:|:--------:|:--------:| | Submit Proposal |13 August | | | Review Proposal | | | | Start implementation | | | | Present results | | | ## :book:Reference 1. [ZKWASM project index](http://go/zkwasm-index) 2. [Risc0 benchmarks](https://benchmarks.risczero.com/main/applications-benchmarks) 3. [Risc0 examples](https://github.com/risc0/risc0/tree/main/examples)