From e8b7b1c4e644679f84e1e20e170d4efa7a624622 Mon Sep 17 00:00:00 2001 From: Kamen Mladenov Date: Tue, 14 Jan 2025 16:39:48 +0200 Subject: feat(zkvms): Export io logic to it's own crate --- zkvms_host_io/src/lib.rs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 zkvms_host_io/src/lib.rs (limited to 'zkvms_host_io/src') 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 { + pub run_type: RunType, + pub input: T, +} + +fn read_input() -> (Vec>, u32, Vec>) { + include!(env!("INPUTS")) +} + +pub fn read_args() -> RunWith<(Vec>, u32, Vec>)> { + let cli = Cli::parse(); + + RunWith { + run_type: cli.run_type, + input: read_input(), + } +} -- cgit v1.2.3