diff options
| author | Kamen Mladenov <kamen@syndamia.com> | 2025-02-12 18:14:27 +0200 |
|---|---|---|
| committer | Kamen Mladenov <kamen@syndamia.com> | 2025-02-13 12:58:08 +0200 |
| commit | bec1651cbcef0f648cbc4051b4056b43cfd4bb4d (patch) | |
| tree | 9b8190a93cf5d9a030ba282581a19068e3c1adb7 /guests | |
| parent | 04cb3f810ad53cbf8e81f5199b205b5cb703aee8 (diff) | |
| download | zkVMs-benchmarks-bec1651cbcef0f648cbc4051b4056b43cfd4bb4d.tar zkVMs-benchmarks-bec1651cbcef0f648cbc4051b4056b43cfd4bb4d.tar.gz zkVMs-benchmarks-bec1651cbcef0f648cbc4051b4056b43cfd4bb4d.zip | |
feat(guests/README): Add more detail and examples
Diffstat (limited to 'guests')
| -rw-r--r-- | guests/README.md | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/guests/README.md b/guests/README.md index 37c3ec4..fa4a297 100644 --- a/guests/README.md +++ b/guests/README.md @@ -6,7 +6,7 @@ These are normal Rust programs, with certain specific patterns implemented for z ## Adding your own program > [!IMPORTANT] -> **Implement your program beforehand!** +> **Fully implement and test your program before trying to add it here!** > Although this repo makes it easy to run your program on all zkVMs, developing is not made easier. 1. **Copy the project to this directory.** @@ -40,7 +40,8 @@ These are normal Rust programs, with certain specific patterns implemented for z 1. Above your main (entrypoint) function add a `#[guests_macro::proving_entrypoint]` attribute 2. Make sure the function is public - 3. Move all input variable declarations as arguments to the main function and remove their assignments + 3. Move all input variable declarations as arguments to the main function and remove their assignments. + Input parsing is built-in and automagically handles types. 4. In case your program works without the standard library, or you want to support lack of std, remember to add `#![cfg_attr(feature = "no_std", no_std)]` at the top of your `lib.rs` @@ -82,6 +83,13 @@ These are normal Rust programs, with certain specific patterns implemented for z Information on the possible values, their meaning and how to choose them, can be found [here](../zkvms/README.md). However, generally, you'll only need to set ZKM's `SEG_SIZE`. + A simple example comes from `fibonacci`: + + ```sh + # ZKM + SEG_SIZE=2783 + ``` + 2. `default_private_input.toml` and `default_public_input.toml` contain default input values for your program. Each [key](https://toml.io/en/v1.0.0#keyvalue-pair) is the name of an attribute in your main function. Keys between the two files must be unique, meaning each main function attribute is defined in **only one** of the files. @@ -89,6 +97,29 @@ These are normal Rust programs, with certain specific patterns implemented for z Whether an input is public or not is defined in these files, **not** in your code! It is preferable for your default input to be short, so the default execution, proving and verification steps are fast. + Again, simple examples are found in `fibonacci`. + For the following main function: + + ```rust + /* ... */ + pub fn main(n: u8, fN: u64) -> bool { + /* ... */ + ``` + + this default private input: + + ```toml + fN = 259695496911122585 + ``` + + and this default public input: + + ```toml + n = 85 + ``` + + are correct. + 7. **Track or commit your project with git.** Due to the way Nix works, you'll need to at least track your guest program (but you probably should commit it). |
