diff options
Diffstat (limited to 'zkvms')
| -rw-r--r-- | zkvms/zkm/guest/Cargo.toml | 4 | ||||
| -rw-r--r-- | zkvms/zkm/host/src/main.rs | 1 | ||||
| -rw-r--r-- | zkvms/zkm/sdk/README.md | 5 | ||||
| -rw-r--r-- | zkvms/zkm/wrapper_macro/src/lib.rs | 23 |
4 files changed, 33 insertions, 0 deletions
diff --git a/zkvms/zkm/guest/Cargo.toml b/zkvms/zkm/guest/Cargo.toml index 2b3a54e..d22916a 100644 --- a/zkvms/zkm/guest/Cargo.toml +++ b/zkvms/zkm/guest/Cargo.toml @@ -1,5 +1,6 @@ [package] name = "guest" +description = "ZKM's specific guest crate, which includes the chosen guest in guests" version = "0.1.0" edition = "2021" @@ -9,3 +10,6 @@ edition = "2021" zkm-runtime = { path = "/nix/store/h9s6kmnx7iafllv10wqhjix5kpyfsh37-zkm-unstable-2025-01-05/runtime/entrypoint" } wrapper_macro = { version = "0.1.0", path = "../wrapper_macro" } + +# The zkp dependency references a chosen guest in guests. It is included +# (inserted here) by Nix. See zkvmLib.nix diff --git a/zkvms/zkm/host/src/main.rs b/zkvms/zkm/host/src/main.rs index e71c121..3706b36 100644 --- a/zkvms/zkm/host/src/main.rs +++ b/zkvms/zkm/host/src/main.rs @@ -39,6 +39,7 @@ async fn prove( ) { prover_input.execute_only = false; + // As far as I can tell, we cannot evade generating the sol verifier step match prover_client .setup_and_generate_sol_verifier("local", &vk_path, &prover_input) .await diff --git a/zkvms/zkm/sdk/README.md b/zkvms/zkm/sdk/README.md index 492fc01..182111b 100644 --- a/zkvms/zkm/sdk/README.md +++ b/zkvms/zkm/sdk/README.md @@ -1,3 +1,8 @@ +This is a copy of [ZKM's project SDK](https://github.com/zkMIPS/zkm-project-template/tree/main/sdk), which changes the zkVM cargo dependencies to point to `/nix/store`. +It is also used as a convinent place which stores the SDK's `libsnark` (`sdk/src/local/libsnark`), so during compilation it is not fetched from the source repo (refer to `zkvms/zkm/default.nix`). + +--- + # ZKM SDK usage ## Use the libsnark diff --git a/zkvms/zkm/wrapper_macro/src/lib.rs b/zkvms/zkm/wrapper_macro/src/lib.rs index 4bb580c..216d3d8 100644 --- a/zkvms/zkm/wrapper_macro/src/lib.rs +++ b/zkvms/zkm/wrapper_macro/src/lib.rs @@ -4,6 +4,29 @@ use proc_macro::TokenStream; mod parse_fn; use crate::parse_fn::{ split_fn, args_split, args_divide_public, args_divide_grouped, group_streams }; +/// Create a body, which reads all public and private inputs, stores them in +/// variables, then executes the guest entrypoint function with those arguments +/// and commits its output. +/// +/// `default_public_input.toml` shows which variables are public. +/// +/// # Usage +/// +/// Inside ZKM's guest (excluding the `entrypoint_expr` call): +/// +/// ```rust +/// make_wrapper!{fn main(...) -> ...} +/// ``` +/// +/// # Example output +/// +/// ```rust +/// { +/// let (...) : (...) = read(); // Public inputs +/// let (...) : (...) = read(); // Private inputs +/// commit::<...>(&zkp::main(..., ..., ...)); +/// } +/// ``` #[proc_macro] pub fn make_wrapper(item: TokenStream) -> TokenStream { let (name, args, ret) = split_fn(&item); |
