diff options
| author | Kamen Mladenov <kamen@syndamia.com> | 2025-02-10 14:12:57 +0200 |
|---|---|---|
| committer | Kamen Mladenov <kamen@syndamia.com> | 2025-02-10 14:12:57 +0200 |
| commit | cff7490868ec8d424ee7443369fcca7add54b907 (patch) | |
| tree | 79d4ac65b94a9f036ea3626eddfdb43e15b1b9bc | |
| parent | 7d2c382a197a1df623483a7d9b2686d24b552ec0 (diff) | |
| download | zkVMs-benchmarks-cff7490868ec8d424ee7443369fcca7add54b907.tar zkVMs-benchmarks-cff7490868ec8d424ee7443369fcca7add54b907.tar.gz zkVMs-benchmarks-cff7490868ec8d424ee7443369fcca7add54b907.zip | |
docs(zkvms/sp1): Add detailed documentation comments
| -rw-r--r-- | zkvms/sp1/guest/Cargo.toml | 4 | ||||
| -rw-r--r-- | zkvms/sp1/wrapper_macro/src/lib.rs | 26 |
2 files changed, 30 insertions, 0 deletions
diff --git a/zkvms/sp1/guest/Cargo.toml b/zkvms/sp1/guest/Cargo.toml index ab6915d..a92954d 100644 --- a/zkvms/sp1/guest/Cargo.toml +++ b/zkvms/sp1/guest/Cargo.toml @@ -1,5 +1,6 @@ [package] name = "guest" +description = "SP1's specific guest crate, which includes the chosen guest in guests" version = "0.1.0" edition = "2021" @@ -10,3 +11,6 @@ sp1-zkvm = { path = "/nix/store/8g5sf8h6nfypnd736x6ns4c44s8g6qd4-sp1-unstable-20 alloy-sol-types = "0.7.7" 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/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); |
