aboutsummaryrefslogtreecommitdiff
path: root/zkvms_host_io/src/lib.rs
diff options
context:
space:
mode:
authorKamen Mladenov <kamen@syndamia.com>2025-01-14 16:39:48 +0200
committerKamen Mladenov <kamen@syndamia.com>2025-01-14 16:39:48 +0200
commite8b7b1c4e644679f84e1e20e170d4efa7a624622 (patch)
treef88ccaa44ce2844285ffd9313535a1560e5a544c /zkvms_host_io/src/lib.rs
parent5e9c547275b23ae6117375f9472d6d109f90625b (diff)
downloadzkVMs-benchmarks-e8b7b1c4e644679f84e1e20e170d4efa7a624622.tar
zkVMs-benchmarks-e8b7b1c4e644679f84e1e20e170d4efa7a624622.tar.gz
zkVMs-benchmarks-e8b7b1c4e644679f84e1e20e170d4efa7a624622.zip
feat(zkvms): Export io logic to it's own crate
Diffstat (limited to 'zkvms_host_io/src/lib.rs')
-rw-r--r--zkvms_host_io/src/lib.rs35
1 files changed, 35 insertions, 0 deletions
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(),
+ }
+}