diff options
| author | Kamen Mladenov <kamen@syndamia.com> | 2025-02-10 15:19:01 +0200 |
|---|---|---|
| committer | Kamen Mladenov <kamen@syndamia.com> | 2025-02-10 15:19:01 +0200 |
| commit | 35dc06a71ec230bd652166360aa8b6b89440c6d0 (patch) | |
| tree | d960ba5d109c3c68e68da4b5da19463af9d25415 /zkvms/zkwasm/host/src | |
| parent | 1cb88615eaa0b6a37d42d99c59ad1e23c5d5aa7a (diff) | |
| download | zkVMs-benchmarks-35dc06a71ec230bd652166360aa8b6b89440c6d0.tar zkVMs-benchmarks-35dc06a71ec230bd652166360aa8b6b89440c6d0.tar.gz zkVMs-benchmarks-35dc06a71ec230bd652166360aa8b6b89440c6d0.zip | |
docs(zkvms/zkwasm): Add detailed documentation comments
Diffstat (limited to 'zkvms/zkwasm/host/src')
| -rw-r--r-- | zkvms/zkwasm/host/src/main.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/zkvms/zkwasm/host/src/main.rs b/zkvms/zkwasm/host/src/main.rs index e480ef5..7ada9e0 100644 --- a/zkvms/zkwasm/host/src/main.rs +++ b/zkvms/zkwasm/host/src/main.rs @@ -5,6 +5,12 @@ use std::process::{Command, Stdio}; static PUBLIC_INPUT_PATH: &str = "public_input.bin"; static PRIVATE_INPUT_PATH: &str = "private_input.bin"; +/// Inserts array sizes before every square bracket +/// +/// # Example +/// +/// If `flat` is "[[0,1], [2,3,4], []]" +/// Output will be "3[2[0,1], 3[2,3,4], 0[]]" fn get_with_sizes(flat: &str) -> String { let mut values = flat .split('[') @@ -47,11 +53,21 @@ fn get_with_sizes(flat: &str) -> String { } } +/// Creates an anonymous function which takes `run_info`, "serializes" the +/// specified input, outputs it into a file and returns a "path:<PATH>" +/// argument, ready to be passed to zkWasm. +/// +/// The macro takes three arguments: run_info input expression, path for file +/// output and the name of a foreach macro. +/// +/// For collection types, first the size is emitted and afterwards its actual +/// values. macro_rules! build_input { ($input:expr , $path:ident , $type:ident) => { |run_info: &RunWith| { let mut ret: Vec<u64> = Vec::new(); $type!{ + // Simplify input string let flat = format!("{:?}", $input.yield) .replace("false", "0") .replace("true", "1") |
