Closed aborg-dev closed 8 months ago
We are nearing the completion of this milestone. Over the last two weeks, we have:
mul
, ne
, or
, shl
, shr_u
, xor
, and
We aim to complete Stage 1 by the end of next week by:
We still need to implement the following instructions:
i32.rotl
, i64.extend_i32_u
, i32.load
, i32.store8
, i32.lt_u
As of now, the spec test pass rates are as follows:
We don't expect a 100% pass rate for Stage 1, as this involves obscure instructions that we don't need (e.g. popcount
).
Right now we fully support following instructions:
add
, eq
, lt_s
, mul
, ne
, or
, shl
, shr_u
, xor
, and
add
, eq
, lt_s
, mul
, ne
, or
, shl
, shr_u
, xor
, and
The up-to-date data about pass rates can be found at https://github.com/near/wasmtime/blob/main/docs/zkasm/test_summary.csv
Quick summary of where we are now:
The missing pieces right now are:
As a next step, we will take relevant spec tests and make sure they work:
Overall, it's been great progress, but it will take us a bit longer to complete Stage 1.
Thanks for the summary, great work all around!
Here is the latest update:
We also have implemented a new approach to storing i32 integers - this yields smaller and faster code for most of the instructions. In particular, this cuts more than half (30k) of lines off ZKASM generated file for SHA256 benchmark. This should hopefully make the debugging easier.
We are also getting a pretty good coverage for i32/i64 instructions now. Here is the improvement from the last time:
We still need more work on the implementation of memory-related ops mentioned in https://github.com/near/near-one-project-tracking/issues/2#issuecomment-1838085253 and on introducing relevant spectests.
Since the last time, we have finished implementing global variables, data segments, and frame pointers. The SHA256 benchmark that we were blocked on now runs till completion within 30k cycles, but it still yields incorrect results.
Even though we still need to fully fix SHA256 benchmark, we decided that it does not make sense to block the start of Stage 2 on that result, as the work on SHA256 is quite tricky to parallelize.
Given that we completed all our other goals, we will declare Stage 1 as complete and will continue working on SHA256 correctness in Stage 2.
Goals
Our long-term goal is to use ZK Proofs to scale NEAR protocol to more shards while maintaining high security guarantees.
The goal of Stage 1 is to support proofs for individual simple WASM programs and pass WASM MVP Spec test.
Supported workloads:
Links to external documentation and discussions
The documentation for the project can be found in near/wasmtime.
All meeting notes and design docs are indexed on HackMD.
Estimated effort
The concrete work items for this project are tracked by the milestone.
It is expected that the runtime team will be working on this project. The people actively working on this project are: @akashin , @MCJOHN974 , and @nagisa .
Stage 1 is expected to be completed by the end of November 2023.
Assumptions
Assumptions and risks are enumerated in the roadmap.
Pre-requisites
All preparatory work has been done in August-September 2023 and can be found here:
Out of scope