Andrew Borg

@aborg-dev

https://aborg.dev

Joined on Jul 31, 2023

  • Codebase: https://github.com/aborg-dev/isa_benchmarks Index document: https://hackmd.io/@aborg-dev/H1JgUcGCR This document describes the set of experiments to find the best ISA that we can use as an intermediate representation when compiling Rust code to Zisk. This involves: Selecting a set of benchmarks and implementing them in Rust Compiling the resulting programs to a range of ISAs supported by Rust compiler with right optimization flags Running the resulting binaries in QEMU and measuring the execution costs in the number and complexity of instructions
     Like  Bookmark
  • This is a summary of work done for building the LLVM backend for Zisk. Assumes knowledge on how Zisk works. For detailed log, see CraneZisk Sync and Status updates The code with Zisk-related experiments is available at: https://github.com/aborg-dev/llvm-project/commit/315c4c94b2875b49fdbc60c8a462fbb7aea73525 https://github.com/0xPolygonHermez/rust/tree/aborg/zisk_llvm
     Like  Bookmark
  • Author: aborg Created on: 26 September 2024 This is a master doc collecting all resources about Zisk compiler toolchain design that were produced so far. All documents are ordered by descending creation time. Final presentation: https://docs.google.com/presentation/d/10Gc1pANVcB-YksC8n66HfVYtvhMPvlx536WsM9SiGgE/view Plans
     Like  Bookmark
  • This document outlines potential projects for improving the performance of Rust programs compiled to Zisk. 1. Improve Rust -> RISC-V -> ZisK translation Summary: Incremental improvements to existing compiler stack, there are some known inefficiencies in the generated RISC-V, we can try to eliminate them at various stages Size: Small, 1 month Impact: Low-Medium - estimate of around 10%-20% perf improvement Risk: Low Items:
     Like  Bookmark
  • 27 January 2025 Took a sick leave, down with the cold together with the rest of my family 17 January 2025 Completed: Experimented with disabling RISCV extensions we don't need to simplify the codebaseQuite difficult as the code that we need depends on those definitions 30k lines of compilation errors, way too much work Reached a dead end trying to replacing Risc register with Zisk registers
     Like  Bookmark
  • Author: aborg Created on: 8 November 2024 Status: Implementation This document outlines the scope of work to build a new Cranelift backend that can lower WASM to ZisK. Plan 1. Prototype Rust -> WASM -> ZisK end-to-end conversion As a first step, we will build an end-to-end prototype to identify all critical decisions that we will need to make in a full solution (see "Open Questions" section below).
     Like  Bookmark
  • Index document: CraneZisk index :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
     Like  Bookmark
  • Author: aborg Created on: 11 August 2023 This is a master doc collecting all resources about ZK WASM design that were produced so far. All documents are ordered by descending creation time. Plans Roadmap Stage 2 tracking issue
     Like  Bookmark
  • Index document: https://hackmd.io/IqQMg6I6Qz-AEc8MSEU4eg July 29, 2024 News and updatesAndrei leaving NEAR in AugustWill cancel the sync, Jordi to chat with Bowen Running examples from https://github.com/0xPolygonHermez/hellozisk_rust/ Missing the toolchain zisk so far hellozisk is deprecated Need access to another Rust repo zisk
     Like  Bookmark
  • Author: akashin Created on: 14 September 2023 Status: Reviewed Related issue: https://github.com/near/nearcore/issues/9514 We're building a Zero-Knowledge prover for execution of WASM programs and are considering to use Cranelift as a compiler backend from WASM to ZK-specific ISA. We want to understand whether this tech stack is the right choice for ZK WASM project for the next 6 months. Background
     Like  Bookmark
  • Author: akashin Created on: September 14, 2023 Status: Final Stage 1 Timeline: September 2023 - November 2023 At this stage we focus on proving individual simple WASM programs. Supported workloads
     Like  Bookmark
  • Links Tech setup Test files https://github.com/akashin/zkwasm/tree/main/data Generated ZK ASM: https://github.com/near/wasmtime/tree/zkasm-hackaton/cranelift/data Investigations https://github.com/near/nearcore/issues/9531 Refactoring/Features https://github.com/near/nearcore/issues/9529
     Like  Bookmark
  • Clone and build https://github.com/akashin/zkwasm/ Clone wasmtime update submodules and build itgit clone https://github.com/near/wasmtime.git git clone git@github.com:near/wasmtime.git Switch to zkasm-hackaton branch Clone https://github.com/0xPolygonHermez/zkevm-proverjs/ Switch to training branch Run npm install + npm run build You can now test .zkasm files with node test/zkasmtest.js ../zkwasm/data/generated/counter.zkasm -d
     Like  Bookmark
  • Index document Timeline - 6-8 September 2023 Goal: Knowledge sharing, supporting ZK WASM work Agenda September 6 Presentation: (1h) Andrei presents WASM and NEAR Contract RuntimeRuntime presentationHigh level flow: https://nomicon.io/RuntimeSpec/Components/ Contract preparation
     Like  Bookmark
  • Created on: 31 July 2023 Author: akashin @ NEAR Related: zkwasm sync Theory Gentle intro to SNARKs ZK MOOC: https://zk-learning.org/ KZG commitments: https://dankradfeist.de/ethereum/2020/06/16/kate-polynomial-commitments.html Plonk: https://eprint.iacr.org/2019/953.pdf
     Like  Bookmark
  • Author: akashin Created on: 11 August 2023 Status: WIP Our long-term goal is to build an efficient ZK prover for a broad set of Web Assembly programs. Background Building such prover is challenging because of the impedance mismatch between current ZK systems that can efficiently prove only some types of computations (arithmetic identities, table lookups) and Web Assembly that assumes a modern CPU architecture with support for bitwise operations, floating point numbers and random-access memory. This could lead to a long proving time, depending on how exactly WASM is mapped to ZK Assembly and PIL. Moreover, Web Assembly instruction set is quite broad and has around 400 instructions which increases the scope of the work. Lastly, because we're aiming for a universal WASM prover that can take as an input a list of WASM programs (e.g. contract calls from the list of NEAR transactions), any optimizations before the execution of WASM programs (similar to optimizations during compilation from WASM to x86) will also have to be proven with ZK circuits. In other words, in practice, we will be comparing the proving time for WASM program with the time it takes to execute the compiled and optimized for x86 version of the same program on a validator machine.
     Like  Bookmark
  • Author: akashin Contributors: nagisa Created on: 11 August 2023 Status: WIP The design is still WIP, but for the first milestone we are trying the following approach: 1. Write a transpiler from WASM to ZK Assembly Based on Wasm Parser by implementing a new visitor that generates appropriate instructions in ZK Assembly.
     Like  Bookmark