aboutsummaryrefslogtreecommitdiff
path: root/zkvms/risc0/wrapper_macro/src
diff options
context:
space:
mode:
Diffstat (limited to 'zkvms/risc0/wrapper_macro/src')
-rw-r--r--zkvms/risc0/wrapper_macro/src/lib.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/zkvms/risc0/wrapper_macro/src/lib.rs b/zkvms/risc0/wrapper_macro/src/lib.rs
index 22afa44..24eddd4 100644
--- a/zkvms/risc0/wrapper_macro/src/lib.rs
+++ b/zkvms/risc0/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 };
+/// Create a body, which reads all inputs, stores them in variables, then
+/// commits the ones, defined as public in `default_public_input.toml` to the
+/// journal and finally executes the guest entrypoint function with those
+/// arguments, committing its output.
+///
+/// # Usage
+///
+/// Inside RISC0's guest (excluding the `entrypoint_expr` call):
+///
+/// ```rust
+/// make_wrapper!{fn main(...) -> ...}
+/// ```
+///
+/// # Example output
+///
+/// ```rust
+/// {
+/// let ... : ... = read();
+/// let ... : ... = read();
+/// ...
+/// commit(&...);
+/// commit(&...);
+/// ...
+/// commit(&zkp::main(..., ..., ...));
+/// }
+/// ```
#[proc_macro]
pub fn make_wrapper(item: TokenStream) -> TokenStream {
let (name, args, ret) = split_fn(&item);