Website Summary Files Commits Branches @commit @diff @stats
path: root / zkvms_host_io / src
diff options
context:
space:
mode:
Commite8b7b1c4e644679f84e1e20e170d4efa7a624622 (patch)
Author
 Kamen Mladenov <kamen@syndamia.com>
2025-01-14 16:39:48 +0200
Committer
 Kamen Mladenov <kamen@syndamia.com>
2025-01-14 16:39:48 +0200
Filesf88ccaa44ce2844285ffd9313535a1560e5a544c /zkvms_host_io/src
zkVMs-benchmarks-e8b7b1c4e644679f84e1e20e170d4efa7a624622.tar
zkVMs-benchmarks-e8b7b1c4e644679f84e1e20e170d4efa7a624622.tar.gz
zkVMs-benchmarks-e8b7b1c4e644679f84e1e20e170d4efa7a624622.zip
Parent5e9c547275b23ae6117375f9472d6d109f90625b (diff)
feat(zkvms): Export io logic to it's own crate
1 files changed, 35 insertions, 0 deletions
-rw-r--r--zkvms_host_io/src/lib.rs35
diff --git a/zkvms_host_io/src/lib.rs b/zkvms_host_io/src/lib.rs
new file mode 100644
index 0000000..29723db
--- /dev/null
+++ b/zkvms_host_io/src/lib.rs
@@ -0,0 +1,35 @@
+use clap::{Parser, ValueEnum};
+use num_traits::NumCast;
+
+#[derive(Parser, Debug)]
+#[command(version, about, long_about = None)]
+struct Cli {
+ /// What the ZKVM is going to do
+ run_type: RunType,
+}
+
+#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
+pub enum RunType {
+ Execute,
+ Prove,
+ Verify,
+}
+
+#[derive(Debug, Copy, Clone, PartialEq, Eq)]
+pub struct RunWith<T> {
+ pub run_type: RunType,
+ pub input: T,
+}
+
+fn read_input() -> (Vec<Vec<bool>>, u32, Vec<Vec<u32>>) {
+ include!(env!("INPUTS"))
+}
+
+pub fn read_args() -> RunWith<(Vec<Vec<bool>>, u32, Vec<Vec<u32>>)> {
+ let cli = Cli::parse();
+
+ RunWith {
+ run_type: cli.run_type,
+ input: read_input(),
+ }
+}