aboutsummaryrefslogtreecommitdiff
path: root/zkvms
diff options
context:
space:
mode:
Diffstat (limited to 'zkvms')
-rw-r--r--zkvms/nexus/guest/Cargo.toml4
-rw-r--r--zkvms/nexus/host/src/main.rs2
-rw-r--r--zkvms/nexus/wrapper_macro/src/lib.rs26
3 files changed, 32 insertions, 0 deletions
diff --git a/zkvms/nexus/guest/Cargo.toml b/zkvms/nexus/guest/Cargo.toml
index c9fcd1b..a10b245 100644
--- a/zkvms/nexus/guest/Cargo.toml
+++ b/zkvms/nexus/guest/Cargo.toml
@@ -1,5 +1,6 @@
[package]
name = "guest"
+description = "Nexus' specific guest crate, which includes the chosen guest in guests"
version = "0.1.0"
edition = "2021"
@@ -8,3 +9,6 @@ nexus-rt = { path = "/nix/store/5cgkj88k6k40gzsa6jwgfcqpkg04awr7-Nexus-zkVM-unst
postcard = { version = "1.0.10", default-features = false, features = ["alloc"] }
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/nexus/host/src/main.rs b/zkvms/nexus/host/src/main.rs
index c8d35e8..0ef8253 100644
--- a/zkvms/nexus/host/src/main.rs
+++ b/zkvms/nexus/host/src/main.rs
@@ -19,6 +19,7 @@ fn main() {
match run_info.run_type {
Execute => unreachable!(),
Prove => benchmarkable!{
+ // Nova<T> doesn't derive Clone
println!("Loading guest...");
let prover: Nova<Local> = Nova::new_from_file(&elf_path).expect("failed to load guest program");
@@ -37,6 +38,7 @@ fn main() {
println!(">>>>> Logging\n{}<<<<<", proof.logs().join(""));
},
Verify => benchmarkable!{
+ // Nova<T> doesn't derive Clone
println!("Loading guest...");
let prover: Nova<Local> = Nova::new_from_file(&elf_path).expect("failed to load guest program");
diff --git a/zkvms/nexus/wrapper_macro/src/lib.rs b/zkvms/nexus/wrapper_macro/src/lib.rs
index 89ddc05..8682ab1 100644
--- a/zkvms/nexus/wrapper_macro/src/lib.rs
+++ b/zkvms/nexus/wrapper_macro/src/lib.rs
@@ -4,6 +4,32 @@ use proc_macro::TokenStream;
mod parse_fn;
use crate::parse_fn::{ split_fn, args_split, args_divide_public, args_divide_grouped };
+/// Creates a body, which reads all inputs, stores them in variables, then
+/// writes the ones, defined as public in `default_public_input.toml` to the
+/// journal and finally executes the guest entrypoint function with those
+/// arguments.
+///
+/// # Usage
+///
+/// Inside Nexus' guest (excluding the `entrypoint_expr` call):
+///
+/// ```rust
+/// make_wrapper!{fn main(...) -> ...}
+/// ```
+///
+/// # Example output
+///
+/// ```rust
+/// {
+/// let ... = read_private_input::<...>().unwrap();
+/// let ... = read_private_input::<...>().unwrap();
+/// ...
+/// write_output::<...>(&...);
+/// write_output::<...>(&...);
+/// ...
+/// write_output::<...>(&zkp::main(..., ..., ...));
+/// }
+/// ```
#[proc_macro]
pub fn make_wrapper(item: TokenStream) -> TokenStream {
let (name, args, ret) = split_fn(&item);