diff options
Diffstat (limited to 'zkvms/sp1/wrapper_macro/src')
| -rw-r--r-- | zkvms/sp1/wrapper_macro/src/lib.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/zkvms/sp1/wrapper_macro/src/lib.rs b/zkvms/sp1/wrapper_macro/src/lib.rs index f7954d7..e8393b2 100644 --- a/zkvms/sp1/wrapper_macro/src/lib.rs +++ b/zkvms/sp1/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_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 SP1'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); |
