From 8e6ec28ab29ebb97e1c59e79d4f143dc4563a07c Mon Sep 17 00:00:00 2001 From: Kamen Mladenov Date: Wed, 5 Feb 2025 11:14:19 +0200 Subject: feat(zkvms/zkwasm): Rework read macro into a procedural macro and improve type composition --- zkvms/zkwasm/guest/src/lib.rs | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) (limited to 'zkvms/zkwasm/guest/src/lib.rs') diff --git a/zkvms/zkwasm/guest/src/lib.rs b/zkvms/zkwasm/guest/src/lib.rs index c92b97c..c7c0572 100644 --- a/zkvms/zkwasm/guest/src/lib.rs +++ b/zkvms/zkwasm/guest/src/lib.rs @@ -1,5 +1,5 @@ use wasm_bindgen::prelude::wasm_bindgen; -use wrapper_macro::make_wrapper; +use wrapper_macro::{ make_wrapper, read }; // https://github.com/DelphinusLab/zkWasm-rust/blob/main/src/lib.rs use zkwasm_rust_sdk::{require, wasm_input, wasm_output}; @@ -19,29 +19,6 @@ fn write(value: u64) { unsafe { wasm_output(value); } } -static VERTICES: u64 = 10; - -macro_rules! read { - // Vec>>> is converted by entrypoint_expr! to - // Vec,Vec,...,Vec,primitive - (Vec $size:literal , $($type:tt)*) => { - { - let mut ret = Vec::new(); - for _ in 0..$size { - ret.push(read!($($type)*)); - } - ret - } - }; - (bool $readfn:tt) => { - ($readfn() != 0) - }; - // Has to be primitive! - ($type:tt $readfn:tt) => { - ($readfn() as $type) - }; -} - #[wasm_bindgen] pub fn zkmain() { zkp::entrypoint_expr!() -- cgit v1.2.3