diff options
| author | Kamen Mladenov <kamen@syndamia.com> | 2025-02-03 10:08:02 +0200 |
|---|---|---|
| committer | Kamen Mladenov <kamen@syndamia.com> | 2025-02-03 10:08:02 +0200 |
| commit | 3a98310bafbfa7cf20d8bfcf41510781567b1417 (patch) | |
| tree | ef766d244869020d5bb9bfd61be438d36e28534f /zkvms_host_io/src/lib.rs | |
| parent | 6945c597d9f39e8d603e8cdac17705c8b167e2ba (diff) | |
| download | zkVMs-benchmarks-3a98310bafbfa7cf20d8bfcf41510781567b1417.tar zkVMs-benchmarks-3a98310bafbfa7cf20d8bfcf41510781567b1417.tar.gz zkVMs-benchmarks-3a98310bafbfa7cf20d8bfcf41510781567b1417.zip | |
feat(zkvms_host_io): Add argument for private input
Diffstat (limited to 'zkvms_host_io/src/lib.rs')
| -rw-r--r-- | zkvms_host_io/src/lib.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/zkvms_host_io/src/lib.rs b/zkvms_host_io/src/lib.rs index d00a1b1..8e49e29 100644 --- a/zkvms_host_io/src/lib.rs +++ b/zkvms_host_io/src/lib.rs @@ -6,6 +6,7 @@ use std::{env, option::Option, fs::read_to_string, collections::HashMap}; pub use input_macros::foreach_input_field; static DEFAULT_PUBLIC_INPUT: &str = include_str!(concat!(env!("INPUTS_DIR"), "/default_public_input.toml")); +static DEFAULT_PRIVATE_INPUT: &str = include_str!(concat!(env!("INPUTS_DIR"), "/default_private_input.toml")); static DEFAULT_ENV: &str = include_str!(concat!(env!("INPUTS_DIR"), "/default.env")); #[derive(Parser, Debug)] @@ -14,6 +15,8 @@ struct Cli { /// What the ZKVM is going to do run_type: RunType, + private_input: Option<String>, + public_input: Option<String>, } @@ -53,12 +56,17 @@ input_macros::generate_output_type_input_struct!(); pub fn read_args() -> RunWith<Input> { let cli = Cli::parse(); - let contents: String = if cli.public_input.is_some() { + let public_contents: String = if cli.public_input.is_some() { read_to_string(cli.public_input.unwrap()).unwrap() } else { DEFAULT_PUBLIC_INPUT.to_string() }; - let input: Input = toml::from_str(&contents).unwrap(); + let private_contents: String = if cli.private_input.is_some() { + read_to_string(cli.private_input.unwrap()).unwrap() + } else { + DEFAULT_PRIVATE_INPUT.to_string() + }; + let input: Input = toml::from_str(&(public_contents + &private_contents)).unwrap(); let default_env = read_str(DEFAULT_ENV).unwrap(); |
