This pull request introduces WebAssembly (WASM) compatibility for the verification process of Jolt. The main changes include:
Extension of jolt new command with --wasm flag:
The jolt new <project-name> --wasm command modifies both the root/Cargo.toml and guest/Cargo.toml files to include the necessary dependencies for WASM. It also marks the project as a cdylib crate type, which is required for WASM compilation.
Addition of jolt build-wasm command
The build-wasm command extracts all functions declared with jolt::provable. It then performs preprocessing steps to build and decode the program, storing the resulting data in binary form. An example index.html file is created to demonstrate how to use the functions generated by the macro extension. Finally, optimized WASM files are created using wasm-pack to make the project ready for use.
Extension of macros:
The macros are enhanced to check if functions are marked with jolt::provable(wasm). If so, necessary imports and helper functions are defined. The output of the preprocessing process is then used to build the WASM-compatible verify-functions.
Current Limitations
Dependencies used in guest/src/lib.rs need to be defined both in guest/Cargo.toml and root/Cargo.toml. This redundancy is known and could be optimized in future iterations.
Currently, this only provides WASM support for proof verification. The proving itself is not yet WASM-compatible, bc it's unclear whether this is a desired requirement.
This pull request introduces WebAssembly (WASM) compatibility for the verification process of Jolt. The main changes include:
jolt new
command with--wasm
flag:jolt new <project-name> --wasm
command modifies both theroot/Cargo.toml
andguest/Cargo.toml
files to include the necessary dependencies for WASM. It also marks the project as acdylib
crate type, which is required for WASM compilation.jolt build-wasm
commandbuild-wasm
command extracts all functions declared withjolt::provable
. It then performs preprocessing steps to build and decode the program, storing the resulting data in binary form. An exampleindex.html
file is created to demonstrate how to use the functions generated by the macro extension. Finally, optimized WASM files are created usingwasm-pack
to make the project ready for use.jolt::provable(wasm)
. If so, necessary imports and helper functions are defined. The output of the preprocessing process is then used to build the WASM-compatible verify-functions.Current Limitations
guest/src/lib.rs
need to be defined both inguest/Cargo.toml
androot/Cargo.toml
. This redundancy is known and could be optimized in future iterations.314